djhenderson / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Pyodbc Doesn't extract full blob #190

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by dasecret...@gmail.com on 25 Jul 2011 at 7:47

GoogleCodeExporter commented 9 years ago
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?

Original comment by mkleehammer on 29 Jul 2011 at 1:12

GoogleCodeExporter commented 9 years ago
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.

Original comment by CollinMA...@gmail.com on 3 Aug 2011 at 7:04

Attachments:

GoogleCodeExporter commented 9 years ago
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")

Original comment by dasecret...@gmail.com on 4 Aug 2011 at 11:47

GoogleCodeExporter commented 9 years ago
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")

Original comment by dasecret...@gmail.com on 4 Aug 2011 at 11:47

GoogleCodeExporter commented 9 years ago
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

Original comment by dasecret...@gmail.com on 4 Aug 2011 at 11:48

GoogleCodeExporter commented 9 years ago
Looks like that worked. Thanks. I also found this stackoverflow explanation:

http://stackoverflow.com/questions/1060035/using-pyodbc-on-ubuntu-to-insert-a-im
age-field-on-sql-server/1073801#1073801

Original comment by CollinMA...@gmail.com on 4 Aug 2011 at 1:49

GoogleCodeExporter commented 9 years ago
It looks like I am also able to fix it by switching TDSVER to 8.0 like so:

os.environ['TDSVER'] = '8.0'

Original comment by CollinMA...@gmail.com on 4 Aug 2011 at 2:52

GoogleCodeExporter commented 9 years ago

Original comment by mkleehammer on 23 Dec 2011 at 8:13