freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Problem with connection.
- Date: Tue, 5 Jan 2010 20:07:07 -0500
Fernando wrote:
> When the app call
> it, the function return an error and the message: "FreeTDS: db-lib:
> exiting because client error handler returned 0 for msgno 20009".
>
> Does anyone knows what this error message mean??
It means the error handler returned 0, which is an instruction to the
library to call exit(3).
$ grep -n INT_ include/sybdb.h
60:#define INT_EXIT 0
61:#define INT_CONTINUE 1
62:#define INT_CANCEL 2
63:#define INT_TIMEOUT 3
> /* works fine until here, then I got the error here, not even enter in
> the if statement */
> if ((dbconn = dbopen(login, DBSERVER)) == NULL)
> {
> fprintf(stderr, "ERROR! dbopen() page1.c.\n");
> return FALSE;
> }
Zero is INT_EXIT. dbopen() never returns because when the handler returns
INT_EXIT, the library exits the program.
http://manuals.sybase.com/onlinebooks/group-cnarc/cng1110e/dblib/@Generic__BookTextView/16561;pt=39614
The default error handler, the one you get if you don't call
dberrhandle(), usually returns INT_CANCEL, cf. default_err_handler() and
dbperror() in dblib.c. However, Sybase's specification, which FreeTDS
conforms to, says that the default handler "will abort the program if the
error has made the affected DBPROCESS unusable". That's what FreeTDS does
if it was compiled with enable-msdblib=no (the default case).
See also
http://www.freetds.org/userguide/samplecode.htm#SAMPLECODE.ERRORS.
In your case, dbopen() failed to connect to the server. It would return a
DBPROCESS of NULL, which would be unusable and for which DBDEAD() would
return true. The default handler detects this, returns INT_EXIT, and the
library duly quits.
The internal function dbperror() produces the message. I feel if the
*library* is going to quit, it should write something to standard error.
(I could be convinced to change FreeTDS to deviate from Sybase's
specification in this case. I've always thought it was weird that
db-lib's default behavior is to print *nothing*. But I wouldn't do it
lightly.)
The message 20009 is SYBECONN, meaning you couldn't connect to the server:
$ grep 20009 include/sybdb.h
#define SYBECONN 20009 /* Unable to connect socket -- SQL Server
#is unavailable or does not exist. */
A TDSDUMP log may help sorting out why not.
HTH.
--jkl
-
[freetds] Problem with connection.,
Fernando, 01/05/2010
- Re: [freetds] Problem with connection., James K. Lowden, 01/05/2010
- <Possible follow-up(s)>
-
Re: [freetds] Problem with connection.,
ikorot, 01/05/2010
- Re: [freetds] Problem with connection., Fernando, 01/05/2010
- Re: [freetds] Problem with connection., ikorot, 01/05/2010
-
Re: [freetds] Problem with connection.,
ikorot, 01/05/2010
-
Re: [freetds] Problem with connection.,
Fernando, 01/13/2010
-
Re: [freetds] Problem with connection.,
James K. Lowden, 01/18/2010
-
Re: [freetds] Problem with connection.,
Frediano Ziglio, 01/19/2010
-
Re: [freetds] Problem with connection.,
James K. Lowden, 01/20/2010
- Re: [freetds] Problem with connection., Frediano Ziglio, 01/21/2010
-
Re: [freetds] Problem with connection.,
James K. Lowden, 01/20/2010
-
Re: [freetds] Problem with connection.,
Frediano Ziglio, 01/19/2010
-
Re: [freetds] Problem with connection.,
James K. Lowden, 01/18/2010
-
Re: [freetds] Problem with connection.,
Fernando, 01/13/2010
Archive powered by MHonArc 2.6.24.