Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connection to tdsool times out with tsql

We are using tdspool and trying to connect to it using tsql locally on the same machine. tdspool seems to open it's connections just fine and starts listening however any client connecting to the pool times out.

pool.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

When connecting to 127.0.0.1:1313 using tsql the tdspool output simply says "accepting connection" and nothing else. The freetds.log outputs the following:

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

OS: CentOS 6.5

like image 370
Sean256 Avatar asked Oct 31 '22 20:10

Sean256


2 Answers

The Software is Bugged

We went to the official mailing list, and asked this question verbatim. The answer seems to be that there isn't one without rewriting the current project.

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.

We spent a considerable amount of time trying to figure out what we were doing wrong, so this is kind of a pain. While I'll be looking to make/modify existing SQL Server pools, I'm disappointed that FreeTDS (a wonderful project) ships with such an unstable pool

like image 159
Daymon Schroeder Avatar answered Nov 09 '22 05:11

Daymon Schroeder


I had similar problem. Will try to help you to solve your. First, ensure your /etc/freetds.conf contains valid configuration:

[global]
tds version = 4.2 
...
[myserver]
    host = <ip>
    port = 1433
    tds version = 4.2 < this is important

Now, /etc/tdspool.conf

 [sampool]
 user = [REDACTED]
 password = [REDACTED]
 database = [REDACTED]
 server = myserver < important
 port = 1313

Then tdspool sampool should start fine. My errors were as follows: 1. I thought that server in pool.conf is ip or domain of server, while really that is reference to server in freetds.conf 2. In freetds.conf I used wrong (too high) tds version. Tdspool supports tds versions up to 4.2, as stated in their docs.

Now, if you try to connect via tsql -S 172.0.0.1:1313, you will still get "accepting connection..." forever. BUT, if you do

tsql -S 127.0.0.1:1313 -U <username> -P <password> -D <database>

you will connect and be able to run queries against your sql server through tdspool.

like image 28
Evk Avatar answered Nov 09 '22 07:11

Evk