Skip to Content.
Sympa Menu

freetds - [freetds] datetime is causing error with pyodbc/freeTDS when accessing MSSQL

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Thang Nguyen <thang.pq.nguyen AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] datetime is causing error with pyodbc/freeTDS when accessing MSSQL
  • Date: Wed, 27 Apr 2011 21:50:37 -0700

Hi,
I am getting an error accessing MSSQL database using pyodbc/FreeTDS
driver. Looks like it has something to do with datetime datatype.
If I delete the "created_at" column (which has datetime data type)
from my table 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
MSSQL 2005

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 "test_product" database table:
===============
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



  • [freetds] datetime is causing error with pyodbc/freeTDS when accessing MSSQL, Thang Nguyen, 04/28/2011

Archive powered by MHonArc 2.6.24.

Top of Page