Install and configure freetds-connect to msssql in Linux
Connecting to MSSQL in Linux is very painful because Microsoft does not provide any interfaces to developers. They think that MSSQL is only a Windows operating system. Fortunately, MSSQL is derived from Sybase. Some buddies have made some connection libraries in Sybase Linux. These connection libraries also support MSSQL, and freetds is just like this.
The intended readers of this article, I think, are those who want to write C or C ++ programs in Linux or UNIX to connect to mssql2000, because I am like this. At the same time, those who write PHP can also refer to it. Of course, if you are using PHP, you may also need to know how to install Apache and PHP scripts.
Speak nonsense and start with the question.
I. Related Software
Freetds Source:
Http://www.freetds.org
Version: 0.63
: Http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
This software can use Linux and UNIX to connect Ms sqlserver and Sybase databases.
Ii. installation and configuration
2.1 compile and install freetds:
$ Tar zxvf freetds-stable.tgz (unzipping)
$./Configure -- prefix =/usr/local/freetds -- With-tdsver = 8.0 -- enable-msdblib
$ Make
# Make install
Parameter description:
Install freetds to the directory/usr/local/freetds: -- prefix =/usr/local/freetds
Mssql2000: -- With-tdsver = 8.0 -- enable-msdblib
2.2 configure freetds library files
Configure the path of the freetds library file to the LD_LIBRARY_PATH parameter:
$ Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/localfreetds/lib /:
The purpose of this operation is to avoid loading the freetds library file.
Iii. Test
Freetds-0.63/src/apps/tsql. C, is a good test program, can compare this file to the MSSQL connection encoding.