Connect to MS SQL Server

xiaoxiao2021-03-01  14

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.

转载请注明原文地址: https://www.6miu.com/read-3650141.html

最新回复(0)