[egenix-users] Invalid cursor state

Dan Fairs dan.fairs at gmail.com
Tue Jul 21 18:21:04 CEST 2009

> Have you tried using the latest unixODBC version ?
>> We're using the following software versions (from Ubuntu's package
>> manager):
>> unixODBC 2.2.11-16build2
>> tdsodbc 0.82-3ubuntu1
>> Zope 2.10.4 (built using buildout and sources, not Ubuntu packages)
>> mxODBCZopeDA-1.0.10
>> SQL Server 2005 Developer (also happens on SQL Server 2008 Express)
>> Zope server is Ubuntu 8.10, though this also happens with 9.04.
>> Python 2.4.5 (built from source)

Just to follow up, we've tried the latest version of unixODBC (2.2.14)  
to no avail.

We seem to be able to provoke the problem most reliably with Python  
code that does the following - using ZSQL methods, the same ZSQL  
method being used for each of the SELECTs:

- Cause a row to be SELECTed from a table
- UPDATE the same row
- SELECT that same row again

We'll then get the 'Invalid cursor state' message on the second select.

Putting a time.sleep(1) before the update and the second select seems  
to prevent the error occurring. Googling the error does seem to  
indicate that this happens (at the C level) when two results handles  
are open simultaneously; the sleep seems to allow some opportunity for  

Obivously not an ideal workaround, but it will at least keep us moving  
until we find a real solution (or re-jig the code flow so that select/ 
update/select pattern doesn't happen).

Dan Fairs <dan.fairs at gmail.com> | http://www.fezconsulting.com/

More information about the egenix-users mailing list