gpt4 book ai didi

sql-server - FreeTDS 连接问题

转载 作者:IT王子 更新时间:2023-10-29 00:25:05 28 4
gpt4 key购买 nike

我正在使用 FreeTDS 0.91 连接到远程 MSSQL 服务器,但到目前为止所有尝试都没有结果。

在我的 Unix 上执行 tsql 命令时,出现以下错误:

  locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20004 (severity 9)
Read from the server failed
OS error 104, "Connection reset by peer"
Error 20002 (severity 9)
Adaptive Server connection failed
There was a problem connecting to the server

freetds.log 中包含以下内容:

16:05:49.144905 20207 (log.c:196):Starting log file for FreeTDS 0.91
on 2011-09-28 16:05:49 with debug flags 0xffff.
16:05:49.145281 20207 (iconv.c:330):tds_iconv_open(0x3d29320, UTF-8)
16:05:49.145426 20207 (iconv.c:187):local name for ISO-8859-1 is ISO-8859-1
16:05:49.145448 20207 (iconv.c:187):local name for UTF-8 is UTF-8
16:05:49.145459 20207 (iconv.c:187):local name for UCS-2LE is UCS-2LE
16:05:49.145469 20207 (iconv.c:187):local name for UCS-2BE is UCS-2BE
16:05:49.145479 20207 (iconv.c:349):setting up conversions for client charset "UTF-8"
16:05:49.145489 20207 (iconv.c:351):preparing iconv for "UTF-8" "UCS-2LE" conversion
16:05:49.145508 20207 (iconv.c:391):preparing iconv for "ISO-8859-1" "UCS-2LE" conversion
16:05:49.145533 20207 (iconv.c:394):tds_iconv_open: done
16:05:49.145550 20207 (net.c:205):Connecting to 70.70.218.13 port 2600 (TDS version 7.0)
16:05:49.145686 20207 (net.c:270):tds_open_socket: connect(2) returned "Operation now in progress"
16:05:49.236008 20207 (net.c:310):tds_open_socket() succeeded
16:05:49.236061 20207 (util.c:156):Changed query state from DEAD to IDLE
16:05:49.236083 20207 (login.c:782):quietly sending TDS 7+ login packet
16:05:49.236173 20207 (token.c:328):tds_process_login_tokens()
16:05:49.857930 20207 (util.c:331):tdserror(0x3d29080, 0x3d29320, 20004, 104)
16:05:49.858072 20207 (util.c:361):tdserror: client library returned TDS_INT_CANCEL(2)
16:05:49.858090 20207 (util.c:384):tdserror: returning TDS_INT_CANCEL(2)
16:05:49.858114 20207 (util.c:156):Changed query state from IDLE to DEAD
16:05:49.858137 20207 (token.c:337):looking for login token, got 0()
16:05:49.858155 20207 (token.c:122):tds_process_default_tokens() marker is 0()
16:05:49.858168 20207 (token.c:125):leaving tds_process_default_tokens() connection dead
16:05:49.858179 20207 (login.c:466):login packet accepted
16:05:49.858189 20207 (util.c:331):tdserror(0x3d29080, 0x3d29320, 20002, 0)
16:05:49.858209 20207 (util.c:361):tdserror: client library returned TDS_INT_CANCEL(2)
16:05:49.858220 20207 (util.c:384):tdserror: returning TDS_INT_CANCEL(2)
16:05:49.858232 20207 (mem.c:615):tds_free_all_results()

这看起来像是 SQL 服务器的问题,还是我安装或配置了 FreeTDS 错误?

迷路了。请帮忙。


当我通过 telnet 连接到服务器时,这是我得到的响应:

正在尝试 70.70.218.13...
连接到 70.70.218.13。
转义字符是'^]'。
^^
外部主机关闭了连接。

这是否意味着与主机的 telnet 连接成功?

SQL 数据库在 Windows 服务器上运行。连接到 Windows 服务器(就像通过远程桌面一样)是否是用于主机名和端口的正确类型的值?还是我必须在 Windows 服务器上找到 SQL 服务器的直接主机名?

最佳答案

汗。

我刚遇到同样的情况。我通过在我的主页中添加 .freetds.conf 解决了这个问题,

[global]
# TDS protocol version
tds version = 7.0

我知道这正是大多数 FreeTDS 连接问题的答案。

并且@Michael Berkowski 也提供了这个方法。

关于sql-server - FreeTDS 连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7590944/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com