Step 1 & 2 can also be installed via the yum install command
Setup 1: Install unixODBC package
Install unixODBC first. Download the software in your home directory or anywhere you like and uncompress and untar the software.
You can do this by using following command
tar -xvzf unixODBC-2.2.12.tar.gz
Once it is done, go to the unixODBCxxxx dir and run the configure command.
./configure –prefix=/usr/local –enable-gui=no
Note: If you dont use enable-gui option and dont have Qt package, you will get the error. So make sure you use it if no Qt is installed.
After configure is successfully completed, run the make and then make install commands.
make
make install
Step 2: Install freeTDS package
Download the freeTDS package and untar and uncompress it.
tar -xvzf freetds-stable.tgz
Run the configure.
./configure –with-tdsver=8.0 –with-unixODBC=/usr/local
Run the make
make
Install it
make install
Step 3: Configuration - freeTDS
Start configuration with freeTDS. Look for the freetds.conf file and add the entry for the MS SQL server.
[MSTEST]
host = 192.168.1.100
port = 1433
tds version = 8.0
Sql server standard port is the 1433. The tds version for MS SQL server 2000 is 8. You can try 8.0 with new version of 2005 and 2008 as well.
Step 4: Configuration – unixODBC
The unixODBC need two main configuration files called odbcinst.ini and odbc.ini. These files should be in the /etc/ dir.
I. The first file odbcinst.ini contain the definition of ODBC driver.
[TDS]
Description = FreeTDS driver
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsodbc.so
Trace = Yes
TraceFile = /tmp/freetds.log
FileUsage = 1
Note: Before making above entries, make sure libtdsodbc.so exists in the /usr/local/lib dir.
In the above configuration, we have define TDS as driver.
II. The second file is odbc.ini. This file has information about your MS SQL database.
[MSTEST]
Driver = TDS
Description = MS SQL Test
Trace = Yes
TraceFile = /tmp/mstest.log
Servername = 192.168.1.100
Database = testdb
Port = 1433
You can notice above that the freeTDS driver is the name defined in odbcinst.ini while servername is the one defined in freetds.conf.
Step 5: Test MS SQL connectivity from Linux box
Check if you can connect to MS SQL database using unixODBC tool called isql.
# isql -v mstest satest satest
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select * from "sysObjects";
If you see the results, you are connected.