[Zope] ZODBC and MSSQL: "Invalid cursor state" bug

Alexander Staubo alex@mop.no
Mon, 10 Jan 2000 22:24:49 +0100


Not being an expert on ODBC, I'm at a loss dealing with this bug. Using
ZODBC 3.1.0b2 (MSSQL 6.5, NT 4.0 SP4), multiple queries -- especially
combining calls to select-type SQL methods with inserts/delete-type
methods -- eventually prompt the following error:

  ('24000', 0, '[Microsoft][ODBC SQL Server Driver]Invalid cursor
state')

Example traceback:

  File c:\zope\lib\python\ZPublisher\Publish.py, line 214, in
publish_module
  File c:\zope\lib\python\ZPublisher\Publish.py, line 179, in publish
  File c:\zope\lib\python\Zope\__init__.py, line 201, in
zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File c:\zope\lib\python\ZPublisher\Publish.py, line 165, in publish
[...]
  File c:\zope\lib\python\Shared\DC\ZRDB\DA.py, line 401, in __call__
    (Object: DeleteFilters)
  File c:\zope\lib\python\Products\ZODBCDA\db.py, line 199, in query
sql.error: (see above)

I can easily reproduce this error, but only in my real-world apps. It
occurs *very easily*. The only workaround that I know is to combine the
operations into to fewer SQL methods -- design hell.

-- 
Alexander Staubo             http://www.mop.no/~alex/
The difference between theory and practice is that, in theory,
there is no difference between theory and practice.