[egenix-users] Invalid cursor state

Dan Fairs dan.fairs at gmail.com
Wed Jul 22 10:24:25 CEST 2009

>> - Cause a row to be SELECTed from a table
>> - UPDATE the same row
>> - SELECT that same row again
> Are you using the ZSQL method from different threads ?

No, these are in the same request; therefore the same thread.

> I assume you are running the UPDATE using a different ZSQL method,
> right ?

That's correct.

(We do have ZSQL methods that do an UPDATE and then immediately SELECT  
the newly-updated data out, incidentally; however, the case I'm  
talking about here doesn't do that. Splitting those up was one of the  
stages in our investigation.)

> It is possible that the ODBC driver tries to do some optimization
> by keeping the result set and the cursor from the first SELECT
> alive even after the Zope DA has closed it.
> This would explain the invalid cursor state, since SQL Server
> does not support multiple active statements on the same connection
> unless you enable the MARS feature available in SQL Server 2005
> and later:
> http://msdn.microsoft.com/en-us/library/ms131686.aspx
> (you can enable this via a connection parameter "Mars_Connection=on")

Ah - now that's interesting. Now you mention it, I do remember MARS  
from my .NET days. Unfortunately the client's servers are only running  
SQL Server 2000; however, we've got 2005 and 2008 dev instances here,  
so we'll try it on those and see if does resolve the issue.


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

More information about the egenix-users mailing list