環境:
Ubuntu12.10_x64
問題:
用tsql訪問SQL Server
>> tsql -H 192.168.88.133 -p 1433 U sa Error 20002 (severity 9): Adaptive Server connection failed
解決:
查看TDS version
>> tsql -C Compile-time settings (established with the "configure" script) Version: freetds v0.91 freetds.conf directory: /usr/local/freetds/etc MS db-lib source compatibility: yes Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 7.1 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: no
查看freetds.conf文件
>> vim /usr/local/freetds/etc/freetds.conf
添加相應的版本信息
# A typical Microsoft server [egServer71] host = ntmachine.domain.com port = 1433 tds version = 7.1
查看數據源文件
>> vim /etc/tds.datasource.template
修改TDS_Version
TDS_Version = 7.1
查看odbc.ini文件
>> vim /etc/odbc.ini
修改TDS_Version
TDS_Version = 7.1
說明:
此問題的解決方法可能不止一種,LZ其實還沒有弄清楚問題的根本,只是通過以上方法解決了問題。LZ會更努力,找出出現此問題的原因,以后會再更新。