With a heavy heart, I find myself having to talk to an MSSQL database. Fortunately, I can do this from a Linux (Fedora) VPS, so all is not lost.

For the following write-up (which are really just notes to myself), these links were helpful :

### Step 1 : Check there’s no firewall in the way

Try the port to check that the response differs from one with no server sitting on it :

### Step 2 : Install FreeTDS

The FreeTDS package is the one that Fedora uses :

### Step 3 : Check that simple queries run (command line - direct)

Using the tsql utility (from FreeTDS), test that the basic connection works (each SQL command needs to be followed by ‘go’ on a separate line to get it to execute) :

When the tsql prompt comes up,

### Step 4 : Check that simple queries run (command line - named server)

In order to connect to the database by ‘name’, add it as an entry into /etc/freetds.conf :

Then queries can be run using the given name (which will then be able to pick out the appropriate hostname and port from the configuration file) :

### Step 5 : Set up ODBC configurations

Firstly, find the driver locations (on disk!) to put into /etc/odbcinst.ini :

Then, create a suitable entry in /etc/odbcinst.ini, so that ODBC know to talk to the FreeTDS drivers :

Then, create an entry in /etc/odbc.ini (which may have to be created) :

### Step 6 : Set up Python connection to ODBC

And then one can use it in the Python shell :

### Step 7 : Read up on ODBC databases in Python

For more, see the PyODBC getting started guide.