datetime is causing error with pyodbc/TDS

600 views
Skip to first unread message

tpnguyen

unread,
Apr 27, 2011, 9:12:33 PM4/27/11
to pyodbc
Hi,
I am getting an error accessing MSSQL database using pyodbc/TDS
driver. Looks like it has something to do with datetime datatype.
If I deldete the created_at column (which has datetime data type) then
the same code will work. Any suggestion for further debugging? Thanks
in advance. -- TN

pyodbc: pyodbc-2.1.8-py2.5-linux-x86_64.egg
TDS: freetds-0.82

here is the python code:
==================
import pyodbc
conn =
pyodbc.connect("DRIVER={FreeTDS};SERVER=myserver;DATABASE=mydatabase;PORT=1435;UID=MYUSER;PWD=MYPASS1")
cursor = conn.cursor()
cursor.execute("select * from test_product")
print cursor.fetchone()

Here is the error:
============
Traceback (most recent call last):
File "testodbc2.py", line 7, in <module>
print cursor.fetchone()
pyodbc.Error: ('HY000', 'The driver did not supply an error!')


Here is the database:
===============
Column name Data Type Value
device varchar(8) xyz
revision varchar(8) ttt
process varchar(10) abc
created_at datetime 4/26/2011 12:20:00 PM

tpnguyen

unread,
Apr 28, 2011, 8:30:15 PM4/28/11
to pyodbc
It turns out that pyodbc was compiled with different
version of unixODBC, so there was a mismatch in the libraries used.
After recompiling pyodbc against the intented version of unixODBC,
things seem to work fine.

TPN
Reply all
Reply to author
Forward
0 new messages