joedborg
joedborg

Reputation: 18353

Cannot get isql to connect to odbc

It's working fine with pyodbc:

pyodbc.connect('DRIVER={MySQL ODBC 3.51 Driver};SERVER=db-server;DATABASE=web;UID=tool;PWD=loot')

But I can't get isql to connect:

$ isql -v db-server tool loot
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect

$ cat /etc/odbcinst.ini
[MySQL ODBC 3.51 Driver]
DRIVER=/usr/lib64/libmyodbc3.so
UsageCount=1

How do I tell isql to use the right driver?

Upvotes: 0

Views: 5612

Answers (1)

bohica
bohica

Reputation: 5992

The first argument to isql needs to be a Data Source Name which exists in /etc/odbc.ini. When you connect via pyodbc you are not using a DSN, you are using DSN-less connections. Create a DSN called db-server in /etc/odbc.ini with driver=MySQL ODBC 3.51 Driver and whatever other attributes the mysql ODBC driver needs to connect then rerun isql.

Upvotes: 1

Related Questions