我正在使用 freetds 从 ubuntu 连接到 mssql 服务器。首先,sql server 正确运行在 1433 端口。我可以远程登录它。以下命令也有效。我可以使用它查询表数据,
sqsh -H 192.168.10.249 -p 1433 -H xx -P xxxxxx
但是,此命令不起作用,因此使我的 ror 应用程序崩溃。
sqsh -S developer -U xxx -P xxxxxxxxx
这是 freetds.log 中的错误
1:24:59.068648 5010 (log.c:190):Starting log file for FreeTDS 0.82 on 2012-06-04 11:24:59 with debug flags 0xffff.
11:24:59.069259 5010 (iconv.c:197):names for ISO-8859-1: ISO-8859-1
11:24:59.069298 5010 (iconv.c:197):names for UTF-8: UTF-8
11:24:59.069317 5010 (iconv.c:197):names for UCS-2LE: UCS-2LE
11:24:59.069335 5010 (iconv.c:197):names for UCS-2BE: UCS-2BE
11:24:59.069352 5010 (iconv.c:363):iconv to convert client-side data to the "UTF-8" character set
11:24:59.069394 5010 (iconv.c:516):tds_iconv_info_init: converting "UTF-8"->"UCS-2LE"
11:24:59.069461 5010 (iconv.c:516):tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
11:24:59.069492 5010 (net.c:836):tds7_get_instance_port(192.168.10.249, MSSQLSERVER)
11:25:00.070784 5010 (net.c:905):tds7_get_instance_port: timed out on try 0 of 16
11:25:01.072121 5010 (net.c:905):tds7_get_instance_port: timed out on try 1 of 16
11:25:02.073441 5010 (net.c:905):tds7_get_instance_port: timed out on try 2 of 16
11:25:03.074756 5010 (net.c:905):tds7_get_instance_port: timed out on try 3 of 16
...
11:25:15.095377 5010 (net.c:905):tds7_get_instance_port: timed out on try 15 of 16
11:25:15.095480 5010 (net.c:974):instance port is 0
11:25:15.095506 5010 (login.c:418):invalid port number
11:25:15.095532 5010 (mem.c:563):tds_free_all_results()
11:25:15.095580 5010 (ct.c:630):leaving ct_connect() returning 0
11:25:15.095605 5010 (ct.c:334):ct_con_props() action = CS_GET property = 9143
11:25:15.095630 5010 (ct.c:1865):ct_con_drop()
11:25:15.095652 5010 (ct.c:242):ct_exit()
这是我的 freetds.conf 文件
[global]
; tds version = 4.2
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
text size = 64512
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 5.0
[developer]
host = 192.168.10.249
port = 1433
#instance = MSSQLSERVER
tds version = 8.0
client charset = UTF-8
dump file = /home/daisy/freetds.log
dump file append = yes
debug flags = 0xffff
从日志输出中,我可以看到在这种情况下程序没有正确读取 sql server 端口,它读取 0 这是错误的。
它还输出一些与编码有关的信息。所以我想这可能与翻译问题有关。