【问题标题】:FreeTDS: Don't ConnectFreeTDS:不要连接
【发布时间】:2017-08-23 14:24:42
【问题描述】:

早上好!

我在运行命令时遇到问题:

tsql -S "servername" - U "user" -P "password"

我得到命令的响应:

There was a problem connecting to the server

我正在尝试连接到 MS SQL 服务器。我已经检查了文档,但我还没有找到解决这个问题的方法。

我的 freetds.conf 是:

[global]
    # TDS protocol version
    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

    # If you get out-of-memory errors, it may mean that your client
    # is trying to allocate a huge buffer for a TEXT field.
    # Try setting 'text size' to a more reasonable limit
    text size = 64512

# A typical Sybase server
[egServer50]
    host = symachine.domain.com
        port = 5000
        tds version = 5.0

# A typical Microsoft server
[egServer70]
    host = ntmachine.domain.com
        port = 1433
        tds version = 7.0

[SRVBD1] 
        host = 10.7.1.7          
        instance = SQL2008
        port = 1434
        tds version = 5.0

检查 FreeTDS 日志文件我注意到以下错误:

11:21:27.243084 22487 (util.c:141):logic error: cannot change query state from READING to WRITING
11:21:27.243095 22487 (util.c:322):tdserror(0x6408e0, 0x13863b0, 20019, 0)
11:21:27.243103 22487 (util.c:358):tdserror: client library not called because either tds_ctx (0x6408e0) or tds_ctx->err_handler is NULL
11:21:27.243111 22487 (util.c:375):tdserror: returning TDS_INT_CANCEL(2)
11:21:27.243118 22487 (util.c:165):Changed query state from READING to READING
11:21:27.243132 22487 (util.c:165):Changed query state from READING to DEAD
11:21:27.243140 22487 (util.c:322):tdserror(0x6408e0, 0x13863b0, 20017, 0)
11:21:27.243148 22487 (util.c:358):tdserror: client library not called because either tds_ctx (0x6408e0) or tds_ctx->err_handler is NULL
11:21:27.243156 22487 (util.c:375):tdserror: returning TDS_INT_CANCEL(2)
11:21:27.243166 22487 (token.c:565):processing result tokens.  marker is  0()
11:21:27.243176 22487 (token.c:116):tds_process_default_tokens() marker is 0()
11:21:27.243184 22487 (token.c:119):leaving tds_process_default_tokens() connection dead
11:21:27.243191 22487 (util.c:83):logic error: cannot change query state from DEAD to PENDING
11:21:27.243199 22487 (util.c:165):Changed query state from DEAD to DEAD
11:21:27.243207 22487 (util.c:322):tdserror(0x6408e0, 0x13863b0, 20056, 9)
11:21:27.243214 22487 (util.c:358):tdserror: client library not called because either tds_ctx (0x6408e0) or tds_ctx->err_handler is NULL
11:21:27.243222 22487 (util.c:375):tdserror: returning TDS_INT_CANCEL(2)
11:21:27.243229 22487 (util.c:322):tdserror(0x6408e0, 0x13863b0, 20017, 0)
11:21:27.243238 22487 (util.c:358):tdserror: client library not called because either tds_ctx (0x6408e0) or tds_ctx->err_handler is NULL
11:21:27.243253 22487 (util.c:375):tdserror: returning TDS_INT_CANCEL(2)
11:21:27.243262 22487 (token.c:336):looking for login token, got  0()
11:21:27.243269 22487 (token.c:116):tds_process_default_tokens() marker is 0()
11:21:27.243277 22487 (token.c:119):leaving tds_process_default_tokens() connection dead
11:21:27.243285 22487 (login.c:472):login packet accepted
11:21:27.243292 22487 (util.c:322):tdserror(0x6408e0, 0x13863b0, 20002, 0)
11:21:27.243300 22487 (util.c:358):tdserror: client library not called because either tds_ctx (0x6408e0) or tds_ctx->err_handler is NULL
11:21:27.243307 22487 (util.c:375):tdserror: returning TDS_INT_CANCEL(2)
11:21:27.243315 22487 (mem.c:648):tds_free_all_results()

有人知道怎么解决吗?

谢谢!

【问题讨论】:

  • 您的示例显示- U(破折号和U之间的空格);尝试删除空间;还是在创建您的问题时这是一个错字?当您将服务器/用户/密码用引号括起来时,tsql 是否正常工作?

标签: freetds


【解决方案1】:

如果您的配置使用tds version = 5.0,SQL Server 2008 不支持。您可以尝试使用tds version = 7.1 代替吗?另外,你确定它在端口1434 而不是1433(默认)?

如果这不起作用,我会在解决问题时修改此答案,但这是我看到的第一个答案。

【讨论】:

    猜你喜欢
    • 2011-11-27
    • 1970-01-01
    • 2017-12-25
    • 1970-01-01
    • 2014-12-31
    • 2011-12-22
    • 1970-01-01
    • 2011-06-16
    • 2016-07-14
    相关资源
    最近更新 更多