sudo apt-get install unixodbc unixodbc-devThis takes care of you being able to use ODBC to connect to ODBC database servers. The other part is having a ODBC driver for the connection to the MS SQL server. There are probably others and I shall list them in due time, but for MS SQL, I found it easiest to use FreeTDS (an implementation of the Tabular Data Stream for Linux).
sudo apt-get install freedts-dev tdsodbcWith this done, you can preceed to modifying the /etc/odbcinst.ini:
sudo nano /etc/odbcinst,ini
Trace = Yes
TraceFile = /tmp/odbc.log
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
UsageCount = 1
sudo apt-get install python-devNow that the system is installed, you will want to install the pydobc module. You can download the latest version of the pyodbc module here. Extract the file where it's convenient for you and 'cd' into the folder.
sudo python setup.py install
Labels: linux, pyodbc, python