Welcome, Guest! Registration

loc2log

Thursday, 2024-04-25
Main » 2015 » June » 17 » [unixODBC][Driver Manager] Data source name not found
7:26 PM
[unixODBC][Driver Manager] Data source name not found

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: 4676 | Added by: ep | Tags: Perl, Database | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Registration | Login ]