I spun around for hours. I cannot connect to the database via pyodbc, but I can use both tsql and isql to connect.
Now I'm just trying (which is probably wrong, but illustrates my point):
import pyodbc
pyodbc.connect("DRIVER={dev};SERVER=epdbdev01;DATABASE=something;USER=epnet2;OPTION=3;")
and I get the following:
Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen({dev}, 6): image not found (0) (SQLDriverConnect)')
I can connect via isql just fine, and for fun:
$ isql -v dev_fail user pass
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
$ isql -v dev user pass
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
you can see that if I use an invalid DSN, I can make a mistake, and with the correct DSN I'm in. Now the error for the wrong DSN is the same error that pyodbc has crossed.
I am struggling with this, I tried things several times, and now my odbc.ini and odbcinst.ini are related to my home settings in my home directory, as shown below:
.freetds.conf -> /usr/local/Cellar/freetds/0.91/etc/freetds.conf
.odbc.ini -> /usr/local/Cellar/unixodbc/2.3.2/etc/odbc.ini
.odbcinst.ini -> /usr/local/Cellar/unixodbc/2.3.2/etc/odbcinst.ini
and finally my odbc.ini and odbcinst.ini files:
odbc.ini
[dev]
Driver = FreeTDS
Description = please work
ServerName = epdbdev01
UID = user
PWD = pass
odbcinst.ini
[FreeTDS]
Description = FreeTDS
Driver = /usr/local/Cellar/freetds/0.91/lib/libtdsodbc.so
Setup = /usr/local/Cellar/freetds/0.91/lib/libtdsodbc.so
client charset = utf-8
pyodbc -, ? , , , - , isql , , pyodbc , , , .