I'm on Mac OS 10.7.5 . I want to connect to an MS SQL db from python2.7. To connect, I've installed and configured FreeTDS and unixodbc. After these, I've installed pyodbc 3.0.10 library through pip.
In the previous versions, pyodbc on Mac installations were compiled to use iODBC, so to make the pyodbc module use unixodbc, some modifications needed to be done before compiling the module. But the later versions (including 3.0.10) are compiled to use unixodbc by default.
After configurations, I've managed to connect to the db using isql, which shows that my unixodbc configurations are in order. But when I try to connect to the db on python as follows;
pyodbc.connect('DSN=DSN;UID=USER;PWD=PASS')
I get the following error:
pyodbc.Error: ('IM002', '[IM002] [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded (0) (SQLDriverConnect)')
Looks like it is trying to use iODBC. What could be causing this?
EDIT: My config files:
freetds.conf:
[SERVERNAME]
host = DBID.database.windows.net
tds version = 7.1
port = 1433
odbcinst.ini
[FreeTDS]
Description = FreeTDS
Driver=/usr/local/lib/libtdsodbc.so
Setup=/usr/local/lib/libtdsodbc.so
odbc.ini
[DSN]
Description = "DESC"
Driver = FreeTDS
Servername = SERVERNAME
Port = 1433
Database = DBNAME