0

I am getting the error :"('24000', '[24000] [FreeTDS][SQL Server]Invalid cursor state (0) (SQLExecDirectW)')" when running pyodbc query using freetds driver.

I have been through multiple articles looking for solutions and most of them indicate that there is an open cursor and it has to be closed before using the cursor again.

I do not have this situation in my code as I am making one single call. The issue is around the size of the data that is returned from the query execution. The length of the string returned is around 32K and this causes the issue. If the large record is excluded, there is no issue during execution.

Steps tried but no help : - FreeTDS conf was altered to change text size - changed the version of FreeTDS

Parachute
  • 1,178
  • 1
  • 8
  • 13
  • Can you include your FreeTDS conf, as well as the output you get when you type `tsql -C`? – FlipperPA Jun 02 '17 at 09:54
  • @FlipperPA : The only change that was done in the freetds conf was to increase the text size. text size = 4294967295 And about tsql-c, can you please let me know what is exactly you need info? I do not get what you asked for. Thanks. – Parachute Jun 02 '17 at 11:26
  • I tried using pymssql and it works like a charm! pypyodbc also has truncation issues. – Parachute Jun 02 '17 at 14:18
  • `tsql` is a FreeTDS command line utility for testing connections and showing configuration. `tsql -C` shows you the FreeTDS configuration, include your global settings and the `freetds.conf` file location it is reading. `pymssql` is great, but isn't maintained as actively, which matters a bit in the Django world but not as much elsewhere. Good luck! – FlipperPA Jun 02 '17 at 18:52

0 Answers0