rails-sqlserver/tiny_tds — Issue #60: Problem connecting to Sybase
Author: amree
Created: 2011-11-08 08:54:55+00:00
State: open

I've successfully managed to connect to Sybase using tds version 5.0/6.0 using tsql (since I can't connect using tds version 7.0). However, I'm getting Adaptive Server connection failed whenever I tried connecting through irb.

I'm using:

* FreeTDS v0.91
* Ruby 1.9.2-p290

This is my freetds log file:

```text
16:26:15.430315 16710 (dblib.c:670):dbinit(void)
16:26:15.430366 16710 (dblib.c:4945):dberrhandle(0xb72eb810)
16:26:15.430375 16710 (dblib.c:4964):dbmsghandle(0xb72eb7c0)
16:26:15.430383 16710 (dblib.c:713):dblogin(void)
16:26:15.430395 16710 (dblib.c:761):dbsetlname(0x81d01f0, smusro, 2)
16:26:15.430403 16710 (dblib.c:761):dbsetlname(0x81d01f0, smusro, 3)
16:26:15.430411 16710 (dblib.c:761):dbsetlname(0x81d01f0, TinyTds, 5)
16:26:15.430419 16710 (dblib.c:923):dbsetlversion(0x81d01f0, 5)
16:26:15.430426 16710 (dblib.c:4040):dbsetlogintime(60)
16:26:15.430434 16710 (dblib.c:3999):dbsettime(5)
16:26:15.430445 16710 (dblib.c:761):dbsetlname(0x81d01f0, UTF-8, 10)
16:26:15.430453 16710 (dblib.c:1146):dbopen(0x81d01f0, MYSERVER, [sybase])
16:26:15.430467 16710 (dblib.c:273):dblib_get_tds_ctx(void)
16:26:15.430482 16710 (config.c:185):Getting connection information for [MYSERVER].
16:26:15.430490 16710 (config.c:189):Attempting to read conf files.
16:26:15.430497 16710 (config.c:354):... $FREETDSCONF not set. Trying $FREETDS/etc.
16:26:15.430504 16710 (config.c:367):... $FREETDS not set. Trying $HOME.
16:26:15.430559 16710 (config.c:293):Could not open '/home/amree/.freetds.conf' ((.freetds.conf)).
16:26:15.430579 16710 (config.c:297):Found conf file '/usr/local/freetds/etc/freetds.conf' (default).
16:26:15.430588 16710 (config.c:483):Looking for section global.
16:26:15.430603 16710 (config.c:540):	Found section global.
16:26:15.430611 16710 (config.c:543):Got a match.
16:26:15.430620 16710 (config.c:565):	dump file = '/tmp/freetds.log'
16:26:15.430628 16710 (config.c:565):	debug flags = '0xffff'
16:26:15.430637 16710 (config.c:565):	text size = '64512'
16:26:15.430646 16710 (config.c:540):	Found section egserver50.
16:26:15.430654 16710 (config.c:540):	Found section egserver70.
16:26:15.430662 16710 (config.c:540):	Found section myserver.
16:26:15.430671 16710 (config.c:554):	Reached EOF
16:26:15.430679 16710 (config.c:483):Looking for section MYSERVER.
16:26:15.430689 16710 (config.c:540):	Found section global.
16:26:15.430699 16710 (config.c:540):	Found section egserver50.
16:26:15.430708 16710 (config.c:540):	Found section egserver70.
16:26:15.430716 16710 (config.c:540):	Found section myserver.
16:26:15.430723 16710 (config.c:543):Got a match.
16:26:15.430730 16710 (config.c:565):	host = 'myserver.com'
16:26:15.430737 16710 (config.c:595):Found host entry myserver.com.
16:26:15.431711 16710 (config.c:599):IP addr is 10.10.10.10.
16:26:15.431734 16710 (config.c:565):	port = '5000'
16:26:15.431750 16710 (config.c:565):	tds version = '5.0'
16:26:15.431763 16710 (config.c:788):Setting tds version to 5.0 (0x500) from $TDSVER.
16:26:15.431787 16710 (config.c:554):	Reached EOF
16:26:15.431800 16710 (config.c:301):Success: [MYSERVER] defined in /usr/local/freetds/etc/freetds.conf.
16:26:15.431827 16710 (config.c:650):tds_config_login: client_charset is UTF-8.
16:26:15.431849 16710 (iconv.c:330):tds_iconv_open(0x83c53f0, UTF-8)
16:26:15.431863 16710 (iconv.c:349):setting up conversions for client charset "UTF-8"
16:26:15.431878 16710 (iconv.c:351):preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
16:26:15.431897 16710 (iconv.c:391):preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
16:26:15.431915 16710 (iconv.c:394):tds_iconv_open: done
16:26:15.431932 16710 (net.c:205):Connecting to 10.10.10.10 port 5000 (TDS version 7.1)
16:26:15.431963 16710 (net.c:270):tds_open_socket: connect(2) returned "Operation now in progress"
16:26:15.462954 16710 (net.c:310):tds_open_socket() succeeded
16:26:15.463000 16710 (util.c:156):Changed query state from DEAD to IDLE
16:26:15.463021 16710 (net.c:741):Sending packet
0000 12 01 00 34 00 00 00 00-00 00 15 00 06 01 00 1b |...4.... ........|
0010 00 01 02 00 1c 00 0c 03-00 28 00 04 ff 08 00 01 |........ .(..ÿ...|
0020 55 00 00 02 4d 53 53 51-4c 53 65 72 76 65 72 00 |U...MSSQ LServer.|
0030 46 41 00 00 - |FA..|

16:26:15.493408 16710 (util.c:331):tdserror(0x850a838, 0x83c53f0, 20017, 115)
16:26:15.493452 16710 (dblib.c:7929):dbperror(0x83c58b0, 20017, 115)
16:26:15.493469 16710 (dblib.c:7981):20017: "Unexpected EOF from the server"
16:26:15.493484 16710 (dblib.c:5780):dbgetuserdata(0x83c58b0)
16:26:15.493499 16710 (dblib.c:8002):"Unexpected EOF from the server", client returns 2 (INT_CANCEL)
16:26:15.493514 16710 (util.c:361):tdserror: client library returned TDS_INT_CANCEL(2)
16:26:15.493529 16710 (util.c:384):tdserror: returning TDS_INT_CANCEL(2)
16:26:15.493560 16710 (util.c:156):Changed query state from IDLE to DEAD
16:26:15.493580 16710 (login.c:466):login packet rejected
16:26:15.493588 16710 (util.c:331):tdserror(0x850a838, 0x83c53f0, 20002, 0)
16:26:15.493598 16710 (dblib.c:7929):dbperror(0x83c58b0, 20002, 0)
16:26:15.493607 16710 (dblib.c:7981):20002: "Adaptive Server connection failed"
16:26:15.493615 16710 (dblib.c:5780):dbgetuserdata(0x83c58b0)
16:26:15.493623 16710 (dblib.c:5780):dbgetuserdata(0x83c58b0)
```