Freetds is used to connect MS SQL Server in linux. and freetds depends on UnixODBC. In fedora, execute
yum -y freetds, freetds-devel
and freetds, unixodbc and freetds-devel will be installed. freetds-devel provides the driver.
Then, configure freetds: (The configuration file is /etc/freetds.conf)
[MSServer]
host=172.29.128.204
port=1433
tds version=7.0
Configure unixodbc
- /etc/odbcinst.ini
[MSSQLServer ] Description=TDS Driver Driver=/usr/lib/libtdsodbc.so Setup=/usr/lib/libtdsodbc.so Trace=Yes TraceFile=/tmp/freetds.log FileUsage=1 - /etc/odbc.ini
[MSSQLServer] Driver = MSSQLServer Description = MS SQL Server Data Source Trace = Yes TraceFile = /tmp/mstext.log Servername = 172.29.128.204 Database = durango_60 Port = 1433
Notice that Driver refers to odbcinst.ini and Servername is defined in freetds.conf.
At last, we can test by executing following commands:
isql MSSQLServer user password
Driver may be in different directory in different version. Make sure the path in the configuration file is valid.
本文介绍如何使用Freetds在Linux环境下连接MSSQL Server。通过安装Freetds及UnixODBC,并配置相关文件如freetds.conf和odbc.ini来实现跨平台数据库连接。文中还提供了测试连接的方法。
932

被折叠的 条评论
为什么被折叠?



