Issue 190: Pyodbc Doesn't extract full blob
Status:  NoFix
Owner: ----
Closed:  Dec 2011
Reported by dasecret...@gmail.com, Jul 25, 2011
What steps will reproduce the problem?
1. place approx 100kb gzip file in sql server 2005 db
2. select gzip file from sql server db
3. check size of selected blob

What is the expected output? What do you see instead?
Expected output is to see the entire blob instead pyodbc is only extracting 4096 bytes of the blob

What version of the product are you using? On what operating system?
version 2.1.8, 64 bit RHEL 5

Please provide any additional information below.
In my particular case the extracted file should be 12428 bytes but pyodbc only extract 4096 bytes. The strange this is doing this same thing in windows xp 32 bit it works fine. But on the linux box it doesn't.

Jul 28, 2011
Project Member #1 mkleehammer
It works on Windows with the Microsoft ODBC driver and is part of the SQL Server unit tests.  On Linux you would be using FreeTDS I assume.  I believe that's where our difference lies.

Can you generate an ODBC trace on Linux?

Status: Investigating
Aug 3, 2011
#2 CollinMA...@gmail.com
I'm getting the same 4096 limit for text fields via FreeTDS on ubuntu 10.04. I get the full result in tsql, but it is truncated in pyodbc. I have attacted an ODBC trace.
sql.log
9.4 KB   View   Download
Aug 4, 2011
#3 dasecret...@gmail.com
I found a way to fix it with free tds in your select statement you
must add the following to it:

SET TEXTSIZE 2147483647

so for instance it would look like: cursor.execute("SET TEXTSIZE
2147483647 select * from blah")
Aug 4, 2011
#4 dasecret...@gmail.com
I found a way to fix it with free tds in your select statement you
must add the following to it:

SET TEXTSIZE 2147483647

so for instance it would look like: cursor.execute("SET TEXTSIZE
2147483647 select * from blah")
Aug 4, 2011
#5 dasecret...@gmail.com
the FREETDS configuration has a set maximum on the returned size of a blob you can change this in the conf file but it's easier to do what's stated above
Aug 4, 2011
#7 CollinMA...@gmail.com
It looks like I am also able to fix it by switching TDSVER to 8.0 like so:

os.environ['TDSVER'] = '8.0'
Dec 23, 2011
Project Member #8 mkleehammer
(No comment was entered for this change.)
Status: NoFix