FreeTDS Installation: Creating DSN for MS-SQL in Ubuntu

Installation of FreeTDS

FreeTDS is a open source implementation of Tabular Data Stream Protocol, used to connect to a number of RDBMS.

Install the following packages in ubuntu

sudo apt-get install unixodbc unixodbc-dev tdsodbc freetds-dev sqsh

We need to append/create the following files

  1. /usr/share/freetds/freetds.conf
  2. /etc/odbcinst.ini
  3. /etc/odbc.ini

sudo vi /usr/share/freetds/freetds.conf
host =
port = 1433
tds version = 7.0

To test if the freeTDS is working fine, use tsql to connect to RDBMS.
Note that the TDS Version is related to SQL server (version). 2007 MSSQL is version 7.0. By default, TDS is set to 5.0


You can lookup the location of the driver using the following command.
find /usr/ -type f -name libtds*

sudo vi /etc/odbcinst.ini
Description = FreeTDS driver
Driver = /usr/lib/i386-linux-gnu/odbc/
FileUsage = 1
UsageCount = 1

sudo vi /etc/odbc.ini
Description = MS SQL Server
Driver = FreeTDS
Server = IP_ADDR
ReadOnly = No
Port = PORT_NO

Test your final DSN with the following command
isql -v MSSQL username password

Note: Please do not leave space at the beginning of the line while editing these files. DSN will not be configured otherwise.

Feel free to report any corrections.


One thought on “FreeTDS Installation: Creating DSN for MS-SQL in Ubuntu

  1. Thanks very much! I’d got FreeTDS set up but couldn’t quite figure out the DSN part.

    Connected to a SQL Server 2008R2 server from Ubuntu 12.04 with you help!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s