The unixODBC Driver Manager

unixODBC is another popular ODBC driver manager available for Unix.

Again, first build unixODBC according to the documentation or install it via RPM, DEB or other package manager.

Now build freetds using the --with-unixodbc flag to specify the location where FreeTDS can find the include files from unixODBC. For instance if unixODBC's header files are in /opt/unixodbc/include use /opt/unixodbc. By default the location will be /usr/local.

$ ./configure --prefix=/usr/local/freetds --with-unixodbc=/usr/local
$ gmake
$ su root
Password: 
$ gmake install

In this example the FreeTDS ODBC libraries will be installed in /usr/local/freetds/lib. Now we need to tell the driver manager where to find them. Do this by editing $HOME/.odbc.ini or the /etc/odbc.ini file. The sample odbc.ini file that comes with FreeTDS in the samples directory will work for either supported driver manager. See the iODBC section for details.

Troubleshooting unixODBC

Supposing everything compiles and installs without trouble, how do you know if unixODBC works? Or, if you know it doesn't, what then?

First, make sure you can connect with tsql. Then try the isql that comes with unixODBC. If tsql works and isql doesn't, you've really isolated the problem to the unixODBC setup. FreeTDS might have some interoperability problems with unixODBC, but mere connection to the database isn't one of them!

Next, try isql -v dsn username password. Probably that won't tell you much more. Last suggestion is to turn on logging. Simple inspection of the log will make clear what server is being connected to (if any) and what account is being used. Often, that will lead you back to the .ini files. Better guidance will be provided in this space as the editor becomes better informed.