Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS 0.82 on Microsoft SUA/Interix

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Mittel, Alexander" <Alexander.Mittel AT siemens.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS 0.82 on Microsoft SUA/Interix
  • Date: Thu, 20 Aug 2009 15:32:15 +0200



-----Ursprüngliche Nachricht-----
Von: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] Im Auftrag von Frediano Ziglio
Gesendet: Donnerstag, 20. August 2009 10:00
An: Chandana De Silva; FreeTDS Development Group
Betreff: Re: [freetds] FreeTDS 0.82 on Microsoft SUA/Interix

2009/8/17 Chandana De Silva <cdesilva AT aconex.com>:
> Hello All,
>
> I am trying to run FreeTDS 0.82 on Windows 2008/SUA, and I get an error, as
> shown below. Hope someone can help.
>
> Thanks
> Chandana
>
> -bash-3.2$ tsql -S localhost -U sa -P XXXXXXX
> locale is "POSIX:POSIX:POSIX:POSIX:POSIX:POSIX"
> locale charset is "ASCII"
> Msg 20008, Level 9, State -1, Server OpenClient, Line -1
> Unable to open socket
> There was a problem connecting to the server
>
> -bash-3.2$ cat .freetds.conf
> [global]
> # TDS protocol version
> tds version = 8.0
>
> # Whether to write a TDSDUMP file for diagnostic purposes
> # (setting this to /tmp is insecure on a multi-user system)
>
> # Command and connection timeouts
> timeout = 10
> connect timeout = 0
>
> # If you get out-of-memory errors, it may mean that your client
> # is trying to allocate a huge buffer for a TEXT field.
> # Try setting 'text size' to a more reasonable limit
> text size = 64512
>
> client charset = ISO-8859
>
> [localhost]
> host = 127.0.0.1
> port = 1433
> tds version = 8.0
> client charset = ISO-8859
> dump file = /tmp/freetds.log
> debug flags = 0xffff
>
>
> I configured it with;
> CFLAGS="-D_ALL_SOURCE -D_REENTRANT"
> CPPFLAGS="-D_ALL_SOURCE -D_REENTRANT -I/usr/local/include"
> LDFLAGS="-L/usr/local/lib"
>
> ./configure --enable-msdblib --with-libiconv-prefix=/usr/local/
> --with-tdsver=8.0
>
> The compiler flags were suggested in the Interix FAQ.
>
> I also had to edit the /usr/include/netdb.h file to add;
>
> /* Possible values left in `h_errno'. */
> #define NETDB_INTERNAL -1 /* See errno. */
> #define NETDB_SUCCESS 0 /* No problem. */
> #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
> #define TRY_AGAIN 2 /* Non-Authoritative Host not found,
> or SERVERFAIL. */
> #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
> NOTIMP. */
> #define NO_DATA 4 /* Valid name, no data record of requested
> type. */
> #define NO_ADDRESS NO_DATA /* No address, look for MX record. */
>
>
> The log file:
> -bash-3.2$ cat /tmp/freetds.log
> 23:15:17.759000 3563 (log.c:190):Starting log file for FreeTDS 0.82
> on 2009-08-16 23:15:17 with debug flags 0xffff.
> 23:15:17.760000 3563 (iconv.c:78):Using trivial iconv
> 23:15:17.760000 3563 (iconv.c:197):names for ISO-8859-1: ISO-8859-1
> 23:15:17.760000 3563 (iconv.c:197):names for UTF-8: UTF-8
> 23:15:17.760000 3563 (iconv.c:197):names for UCS-2LE: UCS-2LE
> 23:15:17.760000 3563 (iconv.c:197):names for UCS-2BE: (null)
> 23:15:17.760000 3563 (iconv.c:363):iconv to convert client-side data to the
> "ASCII" character set
> 23:15:17.760000 3563 (iconv.c:516):tds_iconv_info_init: converting
> "US-ASCII"->"UCS-2LE"
> 23:15:17.760000 3563 (iconv.c:516):tds_iconv_info_init: converting
> "ISO-8859-1"->"UCS-2LE"
> 23:15:17.760000 3563 (net.c:210):Connecting to 127.0.0.1 port 1433 (TDS
> version 8.0)
> 23:15:17.761000 3563 (net.c:264):tds_open_socket: connect(2) returned
> "Operation now in progress"
> 23:15:17.761000 3563 (util.c:334):tdserror(0x1e5550, 0x1e5640, 20008, 80)
> 23:15:17.762000 3563 (util.c:368):tdserror: client library returned
> TDS_INT_CANCEL(2)
> 23:15:17.762000 3563 (util.c:389):tdserror: returning TDS_INT_CANCEL(2)
> 23:15:17.762000 3563 (net.c:310):tds_open_socket() failed
> 23:15:17.762000 3563 (mem.c:563):tds_free_all_results()
>

Quite strange... tds_open_socket line means that client try to connect
to the socket. tdserror 20008 means that tds_select has been called.
tdserror with socket error 80... I don't understand !!! Looking at
time is not a select timeout. Also no error is logged during
tds_select. Where does error 80 came? From winerror.h I can see
ERROR_FILE_EXISTS... perhaps SUA definitions are different ??

freddy77
_______________________________________________

I'm not knowing, what freeTDS does, but...
Looking at "Platform SDK: Windows Sockets 2" for connect()
and error "Operation now in progress":

Operation now in progress.
A blocking operation is currently executing. Windows Sockets only allows a
single blocking operation-per- task or thread-to be outstanding, and if any
other function call is made (whether or not it references that or any other
socket) the function fails with the WSAEINPROGRESS error.

(WSAGetLastError()-Retcode would be "WSAEINPROGRESS" [10036])


While taking a short look at net.c I wonder why tds_select() is called even
if connect() fails:

net.c, 0.82
++++++++++++++++++++++++++++++++++++++++++
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, "tds_open_socket: connect(2)
returned \"%s\"\n", strerror(sock_errno));
#if DEBUGGING_CONNECTING_PROBLEM
if (sock_errno != ECONNREFUSED && sock_errno != ENETUNREACH
&& sock_errno != EINPROGRESS) {
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 = '%s'\n"
, "sin_family",
sin.sin_family
, "sin_port",
sin.sin_port
, "sin_addr.s_addr",
sin.sin_addr.s_addr
, "(param ip_addr)",
ip_addr
);
}
#endif
if (sock_errno != TDSSOCK_EINPROGRESS)
goto not_available;

if (tds_select(tds, TDSSELWRITE|TDSSELERR, timeout) <= 0) {
tds_error = TDSESOCK;
goto not_available;
}
}
++++++++++++++++++++++++++++++++++++++++++


(and v0.83 is complety new: net.c, 0.83.dev.20090725)
++++++++++++++++++++++++++++++++++++++++++
tdsdump_log(TDS_DBG_INFO1, "Connecting to %s port %d (TDS version
%d.%d)\n",
tds_inet_ntoa_r(sin.sin_addr, ip, sizeof(ip)),
ntohs(sin.sin_port),
tds->major_version, tds->minor_version);

if (TDS_IS_SOCKET_INVALID(tds->s = socket(AF_INET, SOCK_STREAM, 0))) {
tds->oserr = sock_errno;
tdsdump_log(TDS_DBG_ERROR, "socket creation error: %s\n",
strerror(sock_errno));
return TDSESOCK;
}
++++++++++++++++++++++++++++++++++++++++++


Hope this helps to find the error.
Mfg Alexander




Archive powered by MHonArc 2.6.24.

Top of Page