python - Retrieving records from SQL Server with PYODBC and FreeTDS -
i have python script connects local sql server (2012, believe?) , runs "select * ..." query. when run script, error saying:
file "/home/mdrouin/dev/redbus/wyndham.py", line 643, in connect cursor.execute("select * [rentaldb].[dbo].[clients]") pyodbc.programmingerror: ('42000', '[42000] [freetds][sql server]unicode info in unicode-only collation or ntext info cannot sent clients using db-library (such isql) or odbc version 3.7 or earlier. (4004) (sqlexecdirectw)')
after reading other posts, tried suggestion thread mentioned adding next script:
os.environ['tdsver'] = '7.0'
however, when this, unicode escape strings (i think that's they're called...) returned, instead of data. illustration of when print row table:
(u'\u00320035\u00380033\u00360033\u00300030\u00300030\u00300030\u00320031\u00320039\u00350039', u'\u00640041\u006d0061\u00520020\u004d0020\u00740061\u00690074\u0067006e\u0079006c\u00280020\u00590057\u0032004e\u00300031', u'\u00640061\u006d0061\u00390073\u006d006d', u'\u006f006a\u006e0068\u00650064\u00720065\u00390065\u00330034', u'\u00330032\u0031002e\u002e0039\u00310035\u0031002e\u00350031')
the thing don't running on vm set same vm, , 1 of vms runs fine while other doesn't. other vm doesn't have either of these issues. checked odbc.ini , odbcinst.ini files on both computers, , same, don't know causing issues. both vms running debian 7.
nevermind... i'm retarded. when set virtualenv in python on vm wasn't working, accidentally used python 2.6 rather python 2.7, in turn allow pyodbc 2.x installed rather pyodbc 3.x. older version of pyodbc causing issues.
python sql sql-server pyodbc freetds
No comments:
Post a Comment