sudo apt-get install unixodbc unixodbc-dev
This 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).
To install:
sudo apt-get install freedts-dev tdsodbc
With this done, you can preceed to modifying the /etc/odbcinst.ini:
sudo nano /etc/odbcinst,ini
[ODBC]
Trace = Yes
TraceFile = /tmp/odbc.log[FreeTDS]
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
CPTimeout =
CPReuse =
UsageCount = 1
Either search for the location or seek Google to find where your distribution saves these files.
You will also need to have the python-dev stuff installed:
sudo apt-get install python-dev
Now 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.
To install simply do:
sudo python setup.py install