sql-server - 使用 tsql 连接到 tdsool 超时

标签 sql-server tsql centos connection-pooling

我们正在使用 tdspool 并尝试在同一台机器上本地使用 tsql 连接到它。 tdspool 似乎可以很好地打开它的连接并开始监听,但是任何连接到池的客户端都会超时。

池.conf

[global]
        min pool conn = 5
        max pool conn = 10
        max member age = 120

[sampool]
        user = [REDACTED]
        password = [REDACTED]
        database = [REDACTED]
        server = [REDACTED]
        port = 1313 ;change to a non standard port so we can see the connection details in the debug log

当使用 tsql 连接到 127.0.0.1:1313 时,tdspool 输出只是说“接受连接”,没有别的。 freetds.log 输出以下内容:

dblib.c:1237:tdsdbopen: Calling tds_connect_and_login(0x2b3fec0, 0x2b40580)
iconv.c:328:tds_iconv_open(0x2b3fec0, UTF-8)
iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
iconv.c:187:local name for UTF-8 is UTF-8
iconv.c:187:local name for UCS-2LE is UCS-2LE
iconv.c:187:local name for UCS-2BE is UCS-2BE
iconv.c:346:setting up conversions for client charset "UTF-8"
iconv.c:348:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:395:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
iconv.c:400:tds_iconv_open: done
net.c:202:Connecting to 127.0.0.1 port 1313 (TDS version 7.3)
net.c:274:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:313:tds_open_socket() succeeded
util.c:165:Changed query state from DEAD to IDLE
packet.c:740:Sending packet
0000 12 01 00 3a 00 00 00 00-00 00 1a 00 06 01 00 20 |...:.... ....... |
0010 00 01 02 00 21 00 0c 03-00 2d 00 04 04 00 31 00 |....!... .-....1.|
0020 01 ff 09 00 00 00 00 00-02 4d 53 53 51 4c 53 65 |........ .MSSQLSe|
0030 72 76 65 72 00 96 24 00-00 00                   |rver..$. ..|

util.c:322:tdserror(0x2a6b8c0, 0x2b3fec0, 20003, 115)
dblib.c:7897:dbperror(0x2b3f3b0, 20003, 115)
dblib.c:7965:dbperror: Calling dblib_err_handler with msgno = 20003; msg->msgtext = "Adaptive Server connection timed out (127.0.0.1:1313)"
dblib.c:5743:dbgetuserdata(0x2b3f3b0)
dblib.c:7987:dbperror: dblib_err_handler for msgno = 20003; msg->msgtext = "Adaptive Server connection timed out (127.0.0.1:1313)" -- returns 2 (INT_CANCEL)
util.c:352:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:375:tdserror: returning TDS_INT_CANCEL(2)
query.c:3769:tds_disconnect()
util.c:165:Changed query state from IDLE to DEAD
login.c:472:login packet rejected
util.c:322:tdserror(0x2a6b8c0, 0x2b3fec0, 20002, 0)
dblib.c:7897:dbperror(0x2b3f3b0, 20002, 0)
dblib.c:7965:dbperror: Calling dblib_err_handler with msgno = 20002; msg->msgtext = "Adaptive Server connection failed (127.0.0.1:1313)"
dblib.c:5743:dbgetuserdata(0x2b3f3b0)
dblib.c:7987:dbperror: dblib_err_handler for msgno = 20002; msg->msgtext = "Adaptive Server connection failed (127.0.0.1:1313)" -- returns 2 (INT_CANCEL)
util.c:352:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:375:tdserror: returning TDS_INT_CANCEL(2)
dblib.c:1241:tdsdbopen: tds_connect_and_login failed for "127.0.0.1:1313"!
dblib.c:1463:dbclose(0x2b3f3b0)
dblib.c:243:dblib_del_connection(0x7fa27f9644a0, 0x2b3fec0)
mem.c:648:tds_free_all_results()
dblib.c:290:dblib_release_tds_ctx(1)
dblib.c:5845:dbfreebuf(0x2b3f3b0)
dblib.c:743:dbloginfree(0x2b3ef10)
dblib.c:1533:dbexit(void)
dblib.c:1533:dbexit(void)
dblib.c:290:dblib_release_tds_ctx(1)

tsql -C:

Version: freetds v0.95.19
             freetds.conf directory: /etc
     MS db-lib source compatibility: yes
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 5.0
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: no
                             GnuTLS: no

操作系统:CentOS 6.5

最佳答案

软件有问题

我们去了官方邮件列表,逐字询问了这个问题。答案似乎是,不重写当前项目就没有。

Client libraries are used and well tested but pool and server are really not in a good shape.

The current state of tdspool is.... it compiles! I'm not surprised it does not run correctly.

That said it's open source. Any help/suggestion/patch is welcome.

我们花了相当多的时间试图找出我们做错了什么,所以这有点痛苦。虽然我将寻求创建/修改现有的 SQL Server 池,但我对 FreeTDS(一个很棒的项目)附带如此不稳定的池感到失望

关于sql-server - 使用 tsql 连接到 tdsool 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32407977/

相关文章:

sql - 在 C 应用程序中使用存储过程而不是 SQL 语句更好吗?

qt - 在 CentOS 5.6 x64 上构建和安装 Qt-4.7.3 错误

bash 脚本通过 ssh 启动服务

sql - 将表从一台服务器复制到另一台服务器

tsql - 无法在 Transact-SQL 场景中创建名称类似于 "DOMAIN\name"的用户

CentOS 6.8 安装rabbitmq 3.7.4

mysql - MySQL 是否与 EF Core 2.0 兼容?

sql-server - SQL Server 2008 - 按带有数字的字符串排序

sql-server - 抑制来自嵌套存储过程调用的虚假结果集

sql-server - VBScript/ASP Classic 和 ADO 中的参数化