FreeTDS:不要连接

时间:2017-08-23 14:24:43

标签: freetds

早!

运行命令时遇到问题:

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()

有谁知道如何解决这个问题?

谢谢!

1 个答案:

答案 0 :(得分:0)

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

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