python pyodbc - working on windows/python2.7 but not on
centOS6.32/python2.6.6
I have the following code:
import pyodbc
cnxn = pyodbc.connect("DRIVER={SQL Server};"
+"SERVER=something.example.com;"
+"DATABASE=something;")
cursor = cnxn.cursor()
name=('Smith, Joe', )
cursor.execute('SELECT id FROM Users WHERE displayname=?', name)
rows = cursor.fetchall()
for row in rows:
print row
The code executes as desired on windows/python2.7. However, when I try to
run it on linux, I get the following error:
Traceback (most recent call last):
File "/something/script.py", line 125, in <module>
main()
File "/something/script.py", line 77, in main
+"DATABASE=something;")
pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source
name not found, and no default driver specified (0) (SQLDriverConnectW)')
The traceback seems to indicate that the DRIVER entry is missing, which
isn't the case. Is this a version difference? What is the issue with
pyodbc?
No comments:
Post a Comment