我正在使用OS X Snow Leopard上安装的FreeTDS 0.82连接到SQL Server 2005数据库。
当我尝试连接tsql时,我明白了:
tsql -S abc -U uuu
locale is "en_US.UTF-8"
locale charset is "UTF-8"
Password:
Msg 20017, Level 9, State -1, Server OpenClient, Line -1
Unexpected EOF from the server
Msg 20002, Level 9, State -1, Server OpenClient, Line -1
Adaptive Server connection failed
There was a problem connecting to the serve
freetds.conf:
[abc]
Host = host.host.domain
port = 1433
tds version = 8.0
日志文件:
13:02:23.904572 97429 (log.c:190):Starting log file for FreeTDS 0.82 on 2011-04-20 13:02:23 with debug flags 0xffff.
13:02:23.904657 97429 (iconv.c:197):names for ISO-8859-1: ISO-8859-1
13:02:23.904669 97429 (iconv.c:197):names for UTF-8: UTF-8
13:02:23.904678 97429 (iconv.c:197):names for UCS-2LE: UCS-2LE
13:02:23.904686 97429 (iconv.c:197):names for UCS-2BE: UCS-2BE
13:02:23.904694 97429 (iconv.c:363):iconv to convert client-side data to the "UTF-8" character set
13:02:23.904715 97429 (iconv.c:516):tds_iconv_info_init: converting "UTF-8"->"UCS-2LE"
13:02:23.904729 97429 (iconv.c:516):tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
13:02:23.904744 97429 (net.c:210):Connecting to 174.46.169.40 port 1433 (TDS version 8.0)
13:02:23.904847 97429 (net.c:264):tds_open_socket: connect(2) returned "Operation now in progress"
13:02:23.966370 97429 (net.c:303):tds_open_socket() succeeded
13:02:23.966422 97429 (util.c:162):Changed query state from DEAD to IDLE
13:02:23.966433 97429 (login.c:735):quietly sending TDS 7+ login packet
13:02:23.966481 97429 (token.c:312):tds_process_login_tokens()
13:02:24.036207 97429 (util.c:334):tdserror(0x1001001d0, 0x100100840, 20017, 0)
13:02:24.036286 97429 (util.c:368):tdserror: client library returned TDS_INT_CANCEL(2)
13:02:24.036300 97429 (util.c:389):tdserror: returning TDS_INT_CANCEL(2)
13:02:24.036327 97429 (util.c:162):Changed query state from IDLE to DEAD
13:02:24.036338 97429 (token.c:316):looking for login token, got 0()
13:02:24.036478 97429 (token.c:108):tds_process_default_tokens() marker is 0()
13:02:24.036494 97429 (token.c:111):leaving tds_process_default_tokens() connection dead
13:02:24.036504 97429 (util.c:334):tdserror(0x1001001d0, 0x100100840, 20002, 0)
13:02:24.036614 97429 (util.c:368):tdserror: client library returned TDS_INT_CANCEL(2)
13:02:24.036626 97429 (util.c:389):tdserror: returning TDS_INT_CANCEL(2)
13:02:24.036639 97429 (mem.c:563):tds_free_all_results()
我已经尝试过版本7.2,7等,它们都显示相同的东西。
答案 0 :(得分:3)
尝试
tds version = 7.0
或者设置以下环境变量:
TDSVER="7.0"
同时确保端口正确,可能因编译时设置而异。您也可以使用以下方式设置环境:
TDSPORT="1433"
答案 1 :(得分:1)
client charset = ISO-8859-1
freetds.conf
中的解决了OSX 10.8上的问题。 / freetds 0.91
答案 2 :(得分:1)
我正在尝试使用MacOSX freetds:
我发现我在/ Users中有一个覆盖主要freetds.conf的.freetds.conf文件
删除.freetds.conf文件后,一切正常
rm /Users/user/.freetds.conf
主文件:
sudo vi /opt/local/etc/freetds/freetds.conf
答案 3 :(得分:1)
我们在应用Linux和MS补丁后间歇性地出现此错误。我们仍然可以从Linux连接到MSSQL服务器,但随机连接将终止EOF错误...即使在查询过程中。我打开了freetds日志,看到加密握手失败,如下所示:
net.c:1366:handshake failed: A TLS packet with unexpected length was received.
login.c:466:login packet rejected
util.c:331:tdserror(0x1e752b0, 0x2c27f40, 20002, 0)
经过多次故障排除后,我们在运行MS SQL Server DB的MS Windows Server 2008 R2服务器上回滚了KB3172605 ...它解决了这个问题。
答案 4 :(得分:0)
我显然遇到了freetds.conf
的问题。在freetds.conf
中设置tds version = 8.0不起作用,在转储日志中它在授权步骤后继续发送INT CANCEL。我的php文件最终看起来像这样(freetds.conf
中的数据库和端口设置工作正常...不知道为什么tds版本没有):
putenv('TDSVER=8.0');<br />
putenv('TDSDUMP=tds.log');<Br />
putenv('FREETDSCONF=freetds.conf');<br />
putenv('FREETDS=freetds.conf');