2

I try to import data to my MSSQL database, however sometimes(! around 9 of 10 times) the code crashes on a Python x64 platform.

[HY090] [Microsoft][ODBC Driver Manager] Invalid string or buffer length

The same code runs fine on 32-bit.

The code gets problems on running sqlGetTypeInfo with SQL_TIMESTAMP(93):

connection="DRIVER={SQL Server Native Client 11.0};SERVER=%s;DATABASE=%s;UID=%s;PWD=%s"%((db["SQL_SERVER"],db["db"],db["user"],db["pwd"]))
conn=pypyodbc.connect(connection)
cur=conn.cursor()
print cur.getTypeInfo(93)

I am running pypyodbc 1.3.3, Python 2.7, MSSQL 2008 and 2012, and my ODBC.dll is 6.1.7601.17514 for both 64/32 bit

How to make it run on Python x64?

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
Peter Parker
  • 29,093
  • 5
  • 52
  • 80
  • Have you tried pyodbc to see if it works better than pypyodbc on x64? – Gord Thompson Jul 12 '16 at 19:47
  • @Gord Thompson: I cannot use pyodbc, as I have certain requirements forbidding me to install binaries on the target machine. So even if it is working I cannot use it. – Peter Parker Jul 13 '16 at 06:38
  • You might not be able to use it in production, but a successful *test* of pyodbc under 64-bit Python might point to a bug in pypyodbc. If that is the case then you'd either need tweak the pypyodbc code yourself, or reach out to someone who could do it for you. – Gord Thompson Jul 13 '16 at 14:32
  • ok, that sounds fine. I was not aware that both projects are coupled so tightly. Thanks! – Peter Parker Jul 14 '16 at 08:21
  • @PeterParker Hi, Did you resolved this issue? Thanks. – mrtpk Jul 26 '17 at 08:33

0 Answers0