Welcome, Guest! Registration

loc2log

Friday, 2024-03-29
Main » 2015 » June » 17

When attempting to use DBI with freetds from your Perl script you may see:

[unixODBC] [Driver Manager] Data source name not found, and no default server specified (SQL-IM002)

That error wording maybe misleading. It sounds like a DSN is missing or misspelled in /etc/odbc.ini, but in fact it also maybe Driver string having a non-exec/non-conforming parameter.

DSNs from /etc/odbc.ini may rely on driver declarations from /etc/odbcinst.ini:

For example, this piece from /etc/odbc.ini

[dsn_example]
...
Driver = SQL
..
Means, that driver info is declared in [SQL] section from /etc/odbcinst.ini. If you don't have the [SQL] declaration in /etc/odbcinst.ini, then you'll get that misleading error:
[unixODBC] [Driver Manager] Data source name not found, and no default server specified (SQL-IM002)

To remedy the error you may either,
declare the driver in /etc/odbcinst.ini,
or use explicit driver path right in /etc/odbc.ini:

[dsn_example]
...
Driver = /usr/lib/libtdsodbc.so.0
..

If you need to debug more, see Troubleshooting ODBC connections. These 3 tools: tsql, isql, osql are indispensable. I did identify that Driver issue with the help of osql.

Views: 4669 | Added by: ep | Date: 2015-06-16 | Comments (0)