Bluebaron
Bluebaron

Reputation: 2516

Can't configure odbc

I've never used ODBC before. I've always done manual connections. Now I'm trying to use OTL and I just can't configure it.

I figured out that for some reason it's not reading my files in /etc/odbc*

It is reading these files from my director (.odbc.ini .odbinst.ini)

~/.odbc.ini:

[localhost]
Driver       = MyODBC Driver
Description  = MyODBC 
SERVER       = localhost
USER         = root
Password     = mypass
Database     = mydb
SOCKET       =

~/.odbcinst.ini:

[ODBC Drivers]
MyODBC Driver = Installed

[MyODBC Driver]
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup  = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so

and this is what happens when I try to connect

con_.rlogon("DSN=localhost");

[unixODBC][Driver Manager]Data source name not found, and no default driver specified

Upvotes: 1

Views: 5902

Answers (1)

bohica
bohica

Reputation: 5992

Firstly that format for the odbcinst.ini file is not unixODBC, it is iODBC. You don't need the [ODBC Drivers] section.

Secondly, unixODBC does not look by default in ~/.odbcinst.ini it usually looks in /etc/odbcinst.ini or /usr/local/etc/odbcinst.ini. You can find out where unixODBC looks for files using odbcinst -j:

$ odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/martin/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

If you insist on using ~/odbcinst.ini to define your drivers you'll need to tell unixODBC that by pointing the ODBCINSTINI environment variable at your file.

Upvotes: 5

Related Questions