thanks Michael.  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

On Wed, Apr 27, 2011 at 5:51 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:
> that error is generated by TDS/pyodbc and is not related to SQLAlchemy.   
> Here's your test case with pyodbc alone, the pyodbc or FreeTDS lists might 
> have further info:
>
> 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()
>
>
>
>
>
> On Apr 27, 2011, at 8:44 PM, Thang Nguyen wrote:
>
>> Hi,
>> I am getting an error accessing MSSQL database using
>> sqlalchemy/pyodbc/TDS driver.  After narrowing the case, looks like it
>> has something to do with datetime datatype.   If I deldete the
>> created_at column (datetime) 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 ePackages
>> import pyodbc
>> import sqlalchemy
>> from sqlalchemy import *
>> import sys, os
>>
>> def pycon():
>>    return 
>> pyodbc.connect("DRIVER={FreeTDS};SERVER=myserver;DATABASE=mydatabase;PORT=1435;UID=MYUSER;PWD=MYPASS1")
>>
>> engine = create_engine('mssql://', creator=pycon)
>> metadata = MetaData(bind=engine)
>> result = engine.execute("select * from test_product")
>> for e in result:
>>    print e.device
>>
>> Here is the error:
>> ============
>> Traceback (most recent call last):
>>  File "testodbc2.py", line 14, in <module>
>>    for e in result:
>>  File "/nfs/test/ePackages/sqlalchemy/engine/base.py", line 1548, in __iter__
>>  File "/nfs/test/ePackages/sqlalchemy/engine/base.py", line 1668, in fetchone
>>  File "/nfs/test/ePackages/sqlalchemy/engine/base.py", line 931, in
>> _handle_dbapi_exception
>> sqlalchemy.exc.DBAPIError: (Error) ('HY000', 'The driver did not
>> supply an error!') None None
>>
>> 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
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To post to this group, send email to sqlalchemy@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> sqlalchemy+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/sqlalchemy?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to