13

Does anyone know a way of testing if an odbc entry on the odbc.ini file is configured correctly?

I would like to know if my linux server is able to connect to my SQL Server using an ODBC entry I configured.

Diego
  • 34,802
  • 21
  • 91
  • 134

2 Answers2

28

If you are using unixODBC as the ODBC driver manager then just do:

isql -v mydsn myusername mypassword
bohica
  • 5,932
  • 3
  • 23
  • 28
2

The most common problem is that the default source build setup is set to /usr/local/etc, not /etc, so you (as me) may be look at a nice config file but unused.

To verify it, just run

# odbc_config --odbcinstini
/usr/local/etc/odbcinst.ini

A simple symbolic link solve it.

Another problem can be a missing library, that you can verify by running the ldd. ex:

# ldd /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0 | grep "not found"
        libodbcinst.so.1 => not found

In this case, I need to put the libodbcinst.so.1 in LD_LIBRARY_PATH or in any directory in use by /etc/ld.so.conf. If you choose to put in ld directories, do not forget to run ldconfig as root after it to update ldd cache file.

ton
  • 3,827
  • 1
  • 42
  • 40