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
sudo vi /usr/share/freetds/freetds.conf
host = 192.168.0.1
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
TDSVER=7.0 tsql -H IP_ADDR -p PORT_NO -U USERNAME -P PASSWORD -D DATABASE_NAME
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/libtdsodbc.so
FileUsage = 1
UsageCount = 1
sudo vi /etc/odbc.ini
Description = MS SQL Server
Driver = FreeTDS
Server = IP_ADDR
UID = USERNAME
PWD = PASSWORD
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.