Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking issue? Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking issue? python python

Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking issue?


Running:

odbcinst -j

It yielded:

unixODBC 2.3.4DRIVERS............: /etc/odbcinst.iniSYSTEM DATA SOURCES: /etc/odbc.iniFILE DATA SOURCES..: /etc/ODBCDataSourcesUSER DATA SOURCES..: /Users/emehex/.odbc.iniSQLULEN Size.......: 8SQLLEN Size........: 8SQLSETPOSIROW Size.: 8

Instead of copying the files to the /etc/ directory (not sure why unixODBC thought they were there) I created a symbolic link to each file:

sudo ln -s /usr/local/etc/odbcinst.ini /etc/odbcinst.inisudo ln -s /usr/local/etc/odbc.ini /etc/odbc.ini

This solved the problem.


In my case, I have a Mac OS and the following commands fixed the problem:

brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-releasebrew updatebrew install msodbcsql mssql-tools

Note 1:It might be necessary that you need to install unixodbc in advance to msodbcsql and mssql-tools as the following:

brew install unixodbc

Note 2:If you dont have already brew, the Missing Package Manager for macOS, then you can install it from here: https://brew.sh/

Note 3: You can verifiy your installation as @emehex already mentioned above with the following commands:

odbcinst -jsudo ln -s /usr/local/etc/odbcinst.ini /etc/odbcinst.inisudo ln -s /usr/local/etc/odbc.ini /etc/odbc.ini


In my case, I had to change the pyodbc database driver string to
driver='{ODBC Driver 17 for SQL Server}'

actually, in my python code pyodbc was expecting ODBC Driver 13 but, as the ODBC Driver version was updated (because of ubuntu update) to current version ODBC Driver 17, the problem had occurred.