linux下连接ms_sql_server的实用工具 - freetds

wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz
tar zxvf freetds-stable.tgz
cd freetds-0.91/
./configure --prefix=/usr/local/freetds --enable-msdblib --enable-dbmfix --with-gnu-ld --enable-shared --enable-static
cd /usr/local/freetds/bin/

然后看见一个tsql的执行程序没,就是它啦
开始照网上例子来连接数据库
./tsql -H 192.168.1.1 -p 1433 -U db_user -P pwd
   --- 返回 ---
   locale is "en_US.UTF-8"
   locale charset is "UTF-8"
   using default charset "UTF-8"
   Error 20017 (severity 9):
           Unexpected EOF from the server
           OS error 115, "Operation now in progress"
   Error 20002 (severity 9):
           Adaptive Server connection failed
   There was a problem connecting to the server

搜索错误时,发现了一位先人:http://www.2cto.com/database/201203/121525.html。被告知为版本错误,5.0不行需要7.0(很神奇的问题)
于是我也照模样做
./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: 5.0
                                 iODBC: no
                              unixodbc: no
                 SSPI "trusted" logins: no
                              Kerberos: no
貌似还真如它所说,当前TDS VERSION的确为5.0
于是
TDSVER=7.0 ./tsql -H 192.168.1.1 -p 1433 -U db_user
ok,看见password输入框了,输入密码,登录成功~

你可能感兴趣的:(linux,sqlserver,FreeTDS)