Friday, April 8, 2011

FreeTDS, a Linux client for MS SQL server

Here are the steps to install and run FreeDTS in Linux.

1) Download freetds

wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

2) Compile and install freetds as root

tar zxvf freetds-stable.tgz
cd freetds-0.82/
./configure --prefix=/usr/local/freetds --enable-msdblib
make
make install

3) Edit configuration file. I added the following portion to
/usr/local/freetds/etc/freetds.conf.

[MSSQL1]
host = MSSQL1.telluriumsource.org
port = 1433
tds version = 8.0

[MSSQL2]
host = MSSQL2.telluriumsource.org
port = 1433
tds version = 8.0

4) Add environment variables by adding the following lines
to /etc/profile.

export TDSVER=8.0
export FREETDS_HOME=/usr/local/freetds
export PATH=$FREETDS_HOME/bin:$PATH

5) Use tsql tool to connect to Database. For the databases I
registered in /usr/local/freetds/etc/freetds.conf, you can use
-S servername to specify the database, for example,

tsql -S MSSQL1 -U 'NTDomain\jfang' -D databaseName

0 comments:

Post a Comment