[freetds] Invalid cursor state

jklowden at schemamania.org jklowden at schemamania.org
Thu Mar 11 17:15:04 EST 2010


On Thu, Mar 11, 2010 at 12:27:30PM -0500, Swapnil Shinde wrote:
> I am using a combination of Snort+unixODBC+freeTDS+mssql. Everything is
> working fine except freeTDS is giving me following error for every query
> after the first query made by the Snort.
> 
> *DIAG [24000] [FreeTDS][SQL Server]Invalid cursor state *
> 
> After doing some research; I have found that in order to do multiple queries
> at faster rate; one needs to enable MARS (Multiple Active Result Sets)
> parameter in the connection API of mssql. 

http://www.freetds.org/faq.html#pending

I don't know exactly what's happening, but if the Snort folks say you *need* MARS, it won't work with FreeTDS and it's not portable.  If anyone on that team is interested, I'm happy to guide them to the One True TDS Way.  

A TDS client must process (or cancel) all results from a query before issuing a new query.  MARS is a Microsoft-only workaround to that basic feature of the TDS protocol.  If we get a patch to make MARS work on FreeTDS, great, we'll apply it if it's good enough.  But I for one see no need.  

It's quite easy to program within the one-query-at-a-time paradigm.  Anyone not doing so is cruising for a bruising when the backend is e.g. Sybase.  

HTH.  

--jkl



More information about the FreeTDS mailing list