• ODBC.ini update did not work

    After running the same database for quite some time for a rails application, we finally had to change the database in odbc.ini to point to the new server. Alas we changed the odbc.ini file, shut down the old database and relaunched the application. Expecting the application to immediately start talking to the database on reboot (since we just changed an IP) we were surprised to find that the application was not connecting to the database anymore.

    The rails application was connecting to SQL Server as detailed in this previous post using ODBC and FreeTDS.

    Upon investigation we found that a .odbc.ini file gets created in the users folder who is running the application. /etc/odbc.ini is the system configuration file which we had setup previously, while /home/username/.odbc.ini must have been created the first time we connected to the SQL Server. Although we had changed /etc/odbc.ini, this change was not reflected in /home/username/.odbc.ini. After changing the .odbc.ini everything worked like it should.

    Another solution that probably would have worked for us was reinstalling with odbcinst.

    odbcinst -i -s -l -f /etc/odbc.ini


    Leave a reply