Skip to Content.
Sympa Menu

freetds - Re: [freetds] Cannot connect to MS SQL 2008 server from OS X using FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Paul Wuersig <pwuersig AT nvidia.com>
  • To: Randy Syring <rsyring AT gmail.com>, FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Cannot connect to MS SQL 2008 server from OS X using FreeTDS
  • Date: Mon, 9 Apr 2012 12:36:24 -0700

TDSDUMPCONFIG revealed the error; it wasn't parsing the ~/.freetds.conf
server information properly because the [Name] didn't match the host being
given. Fixed that, and set the TDS version properly, and it's working now.

Thanks much for your help, guys! I'll keep these logging bits handy in case I
hit any subsequent problems.

Cheers,
Paul

From: Randy Syring <rsyring AT gmail.com<mailto:rsyring AT gmail.com>>
Date: Mon, 9 Apr 2012 12:20:27 -0700
To: FreeTDS Development Group
<freetds AT lists.ibiblio.org<mailto:freetds AT lists.ibiblio.org>>
Cc: Paul Wuersig <pwuersig AT nvidia.com<mailto:pwuersig AT nvidia.com>>
Subject: Re: [freetds] Cannot connect to MS SQL 2008 server from OS X using
FreeTDS

Paul,

I'd recommend using the TDSDUMPCONFIG option. It seems to me you aren't even
hitting the server.

---------------------------------------------
Randy Syring
Development & Executive Director
Level 12 Technologies<https://www.lev12.com/>
Direct: 502-276-0459
Office: 502-212-9913

Principled People, Technology that Works


On 04/09/2012 03:14 PM, Paul Wuersig wrote:

I've also set up iODBC and added the FreeTDS and server information to
odbc.ini and odbcinst.ini.

Running a python script that uses pyodbc yields the error:
pyodbc.Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL
Server}, 6): image not found (0) (SQLDriverConnect)')


[Frediano]

Did you enable OpenSSL or GnuTLS?


[Paul]

No, I didn't realize those were potentially necessary. Is there a way to
query the DB to find out?

[Randy]

<turn on logging!>

[Paul]

$ TDSDUMP=/tmp/freetds.log tsql -H hqnvogl02 -p 1433 -U restuser
locale is "en_US.UTF-8"
locale charset is "UTF-8"
Password:
Msg 20017, Level 9, State -1, Server OpenClient, Line -1
Unexpected EOF from the server
Msg 20002, Level 9, State -1, Server OpenClient, Line -1
Adaptive Server connection failed
There was a problem connecting to the server

--

The salient part of the log is, I believe:
token.c:312:tds_process_login_tokens()
util.c:334:tdserror(0x7fe251400b10, 0x7fe251401170, 20017, 36)
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)


Thanks,
Paul


Full log follows (server and user names redacted in packet):


$ cat /tmp/freetds.log
log.c:190:Starting log file for FreeTDS 0.82
on 2012-04-09 14:00:52 with debug flags 0x4fff.
iconv.c:197:names for ISO-8859-1: ISO-8859-1
iconv.c:197:names for UTF-8: UTF-8
iconv.c:197:names for UCS-2LE: UCS-2LE
iconv.c:197:names for UCS-2BE: UCS-2BE
iconv.c:363:iconv to convert client-side data to the "UTF-8" character set
iconv.c:516:tds_iconv_info_init: converting "UTF-8"->"UCS-2LE"
net.c:210:Connecting to 172.20.148.45 port 1433 (TDS version 5.0)
net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:303:tds_open_socket() succeeded
util.c:162:Changed query state from DEAD to IDLE
net.c:779:Sending packet
0000 02 00 02 00 00 00 00 00-6d 6f 6e 65 00 00 00 00 |........ XXXX....|
0010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0020 00 00 00 00 00 00 04 72-65 73 74 75 73 65 72 00 |.......X XXXXXXX.|
0030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0040 00 00 00 00 00 08 61 70-70 6c 65 00 00 00 00 00 |......XX XXX.....|
0050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0060 00 00 00 00 05 33 37 38-37 36 00 00 00 00 00 00 |.....378 76......|
0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0080 00 00 00 05 03 01 06 0a-09 01 00 00 00 00 00 00 |........ ........|
0090 00 00 00 00 54 53 51 4c-00 00 00 00 00 00 00 00 |....TSQL ........|
00a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
00b0 00 00 04 68 71 6e 76 6f-67 6c 30 32 00 00 00 00 |...XXXXX XXXX....|
00c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
00d0 00 09 00 05 61 70 70 6c-65 00 00 00 00 00 00 00 |.....XXX X.......|
00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
00f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0100 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0110 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0180 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0190 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01b0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01d0 00 07 05 00 00 00 54 44-53 2d 4c 69 62 72 61 72 |......TD S-Librar|
01e0 0a 05 00 00 00 00 0d 11-75 73 5f 65 6e 67 6c 69 |........ us_engli|
01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |sh...... ........|

net.c:779:Sending packet
0000 02 01 00 61 00 00 00 00-00 00 00 00 00 00 0a 00 |...a.... ........|
0010 00 00 00 00 00 00 00 00-00 00 00 00 00 69 73 6f |........ .....iso|
0020 5f 31 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |_1...... ........|
0030 00 00 00 00 00 00 00 00-00 00 00 05 01 35 31 32 |........ .....512|
0040 00 00 00 03 00 00 00 00-e2 16 00 01 09 00 08 0e |........ ?.......|
0050 6d 7f ff ff ff fe 02 09-00 00 00 00 02 68 00 00 |m.????.. .....h..|
0060 00 - |.|

token.c:312:tds_process_login_tokens()
util.c:334:tdserror(0x7fe251400b10, 0x7fe251401170, 20017, 36)
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
util.c:162:Changed query state from IDLE to DEAD
token.c:316:looking for login token, got 0()
token.c:108:tds_process_default_tokens() marker is 0()
token.c:111:leaving tds_process_default_tokens() connection dead
util.c:334:tdserror(0x7fe251400b10, 0x7fe251401170, 20002, 0)
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
mem.c:563:tds_free_all_results()



On 4/6/12 9:52 PM, "Randy Syring"
<rsyring AT gmail.com><mailto:rsyring AT gmail.com> wrote:



Google "freetds logging" and dump info about the connection using that
info
to help diagnose the problem.

---------------------------------------------
Randy Syring (sent from my mobile)
Development & Executive Director
Level 12 Technologies
Direct: 502-276-0459
Office: 502-212-9913

Principled People, Technology that Works
On Apr 6, 2012 7:51 PM, "Paul Wuersig"
<pwuersig AT nvidia.com><mailto:pwuersig AT nvidia.com> wrote:



The basic error looks like so:

$ tsql -H <hostname> -p 1433 -U <user>
Password:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20017 (severity 9):
Unexpected EOF from the server
OS error 36, "Operation now in progress"
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server

This is identical to the error from using tsql to connect to *any* open
port!

Connecting with "-S <server> -U <user>", or connecting to any closed
port,
produces error 20009:
Error 20009 (severity 9):
Unable to connect: Adaptive Server is unavailable or does not
exist
OS error 61, "Connection refused"

I can connect to the server just fine using MS SQL Server Management
Studio on Windows XP.

I've tried other MS-SQL servers, which produce the same errors.

I've tried FreeTDS 0.82, 0.91, and freetds-0.92.dev.20120312 (latest).
Same errors on all of them (although the errors are printed slightly
differently in 0.82).

I've tried 0.92 with "MS db-lib source compatibility" enabled, with the
same results.

The server has an entry in /usr/local/etc/freetds.conf. I've tried tds
version 0, 5.0, 7.0, 7.1, 7.2, and 8.0, with the same results.

I've Googled this extensively, and I've tried essentially all the things
people have suggested for similar errors.

This is on a Mac running 10.7.3.

Suggestions, or things to try, or more information I can give that might
prove fruitful, are all appreciated!

Thanks,
Paul



-------------------------------------------------------------------------
----------
This email message is for the sole use of the intended recipient(s) and
may contain
confidential information. Any unauthorized review, use, disclosure or
distribution
is prohibited. If you are not the intended recipient, please contact
the
sender by
reply email and destroy all copies of the original message.


-------------------------------------------------------------------------
----------
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org<mailto:FreeTDS AT lists.ibiblio.org>http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org<mailto:FreeTDS AT lists.ibiblio.org>http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org<mailto:FreeTDS AT lists.ibiblio.org>http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page