How to query MSSQL database with Debian GNU/Linux (Sarge)

Every now and then you have to do unpleasant things and so one day I was faced with data hidden in MSSQL database. Searching internet I was not able to find a solution so I asked for help on Debian User mailing list and got this reply.
Following the suggestions I managed to get what I needed and here it is the whole process.

First install unixodbc package
apt-get install unixodbc
If you want GUI then also install unixodbc-bin

Next install package
apt-get install freetds-dev
the freetds-dev package has two dependencies which will be also installed

During the freetds-dev package instalation you will be asked if you want the FreeTDS ODBC Driver to be registered automaticaly with unixODBC. If you say no, you will have to do it manualy afterwards.

After this follow the manuals on unixodbc.org to configure the whole thing.

If you followed the above steps you can skip directly to chapter “Creating an ODBC Data Source Name” of the How to use unixODBC with FreeTDS manual and configure ODBC Data Source Name.

To make your steps around ODBC GUI easyer read the User Manual

Installation occured on 21.9.2006
this document was last changed on 21.9.2006

One Response to “How to query MSSQL database with Debian GNU/Linux (Sarge)”

  1. Mitja says:

    Currently I’m making some PHP scripts which will run on my Debian server and pull data from MSSQL database located on Windows server.
    I found a great resource describing how to do this:
    http://howtoforge.com/php5_mssql_debian_etch_free_tds_unix_odbc

Leave a Reply