freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Issue connecting to SQL Server from Linux Host withnewerversions of FreeTDS...
- From: "Glenn, Chris" <Glenn AT addsys.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Issue connecting to SQL Server from Linux Host withnewerversions of FreeTDS...
- Date: Tue, 28 Nov 2006 08:10:29 -0500
I installed the patch, but had to make a minor change to it. The
'sin_len' was an undefined reference.
With that reference removed, below is the new logging information;
-------------------------------------------------------------------
util.c:292:Starting log file for FreeTDS 0.65.dev.20061128
on 2006-11-28 08:05:39 with debug flags 0x4fff.
iconv.c:195:names for ISO-8859-1: ISO-8859-1
iconv.c:195:names for UTF-8: UTF-8
iconv.c:195:names for UCS-2LE: UCS-2LE
iconv.c:195:names for UCS-2BE: UCS-2BE
iconv.c:361:iconv to convert client-side data to the "ANSI_X3.4-1968"
character set
iconv.c:514:tds_iconv_info_init: converting "US-ASCII"->"UCS-2LE"
iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
net.c:184:Connecting to 10.3.2.40 port 1433 (TDS version 7.0)
net.c:239:error: connect(2) returned 0x73, "Operation now in progress"
net.c:241:Contents of sockaddr_in
0000 02 00 05 99 0a 03 02 28-07 00 00 00 00 00 00 00 |.......( ........|
net.c:242: sockaddr_in:
sin_family = 2
sin_port = 9905
sin_addr.s_addr = 2802030a
(param ip_addr) = '10.3.2.40'
net.c:272:tds_open_socket: 10.3.2.40:1433: Invalid argument
util.c:120:Changing query state from IDLE to DEAD
-------------------------------------------------------------------
-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Lowden, James K
Sent: Monday, November 27, 2006 6:30 PM
To: FreeTDS Development Group
Subject: Re: [freetds] Issue connecting to SQL Server from Linux Host
withnewerversions of FreeTDS...
> From: Glenn, Chris
> Sent: Monday, November 27, 2006 9:06 AM
>
> I'm having an issue to connecting from a Red Hat Linux host to a
> SQL Server. I have older copies of FreeTDS that can connect (the
> 'newest' that I have that works is the freetds-0.65.dev.20060224
> build). I have been downloading and trying nightly builds since
> October without any success.
> ...
> net.c:184:Connecting to 10.3.2.40 port 1433 (TDS version 7.0)
> net.c:257:tds_open_socket: 10.3.2.40:1433: Invalid argument
Just last night I was reviewing our networking code in conjunction with
reading Steven's book, and it so happens I was looking at that very
function.
EINVAL is not a nice error code; it says we're not supplying a good
value for some element of the sockaddr_in structure. NetBSD's manpage
doesn't even mention it at as valid errno value for connect(2).
The code itself looks OK, and comparing it to revision 1.14 (Tue Feb 22
16:04:36 2005), most of the changes are to the logging code and adding
support for DOS32. That makes me wonder if it's a matter of configure
perhaps misdetecting your system somehow. I think it was around that
time that we upgraded the toolset that generates the configure script.
I added yet more logging code, cf. patch below. With it, your log file
should now dump the sockaddr_in structure. You can verify that, say,
sin_family really is AF_INET according to your system's header files.
I'm not sure we should leave this code in; it won't compile under Win32,
for instance. But it will be in the next snapshot, and maybe it will
help solve your problem.
--jkl
== snip ==
Index: src/tds/net.c
===================================================================
RCS file: /cvsroot/freetds/freetds/src/tds/net.c,v
retrieving revision 1.46
diff -u -r1.46 net.c
--- src/tds/net.c 26 Nov 2006 21:00:54 -0000 1.46
+++ src/tds/net.c 27 Nov 2006 22:51:34 -0000
@@ -235,6 +235,23 @@
retval = connect(tds->s, (struct sockaddr *) &sin, sizeof(sin));
if (retval == 0) {
tdsdump_log(TDS_DBG_INFO2, "connection established\n");
+ } else {
+ tdsdump_log(TDS_DBG_ERROR, "error: connect(2) returned
0x%x, \"%s\"\n", sock_errno, strerror(sock_errno));
+ if (sock_errno != ECONNREFUSED && sock_errno !=
ENETUNREACH) {
+ tdsdump_dump_buf(TDS_DBG_ERROR, "Contents of
sockaddr_in", &sin, sizeof(sin));
+ tdsdump_log(TDS_DBG_ERROR, "
sockaddr_in:\t"
+ "%s =
%x\n"
+ "\t\t\t%s =
%x\n"
+ "\t\t\t%s =
%x\n"
+ "\t\t\t%s =
%x\n"
+ "\t\t\t%s =
'%s'\n"
+ , "sin_len",
sin.sin_len
+ , "sin_family",
sin.sin_family
+ , "sin_port",
sin.sin_port
+ ,
"sin_addr.s_addr", sin.sin_addr.s_addr
+ , "(param
ip_addr)", ip_addr
+ );
+ }
}
if (retval < 0 && sock_errno == TDSSOCK_EINPROGRESS)
retval = 0;
== snip ==
-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly
prohibited. If you are
not the intended recipient, please contact the sender immediately by
reply e-mail
and destroy all copies of the original message. Please note that we do
not accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the
intended recipient
of this message, the purpose of which is to inform and update our
clients, prospects
and consultants of developments relating to our services and products,
would not
like to receive further e-mail correspondence from the sender, please
"reply" to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the
Americas, New York,
NY 10105.
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
-
Re: [freetds] Issue connecting to SQL Server from Linux Host withnewerversions of FreeTDS...,
Glenn, Chris, 11/28/2006
- Re: [freetds] Issue connecting to SQL Server from Linux Host withnewerversions of FreeTDS..., Christos Zoulas, 11/28/2006
Archive powered by MHonArc 2.6.24.