Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problem with connection.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: ikorot AT earthlink.net
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>, FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problem with connection.
  • Date: Tue, 5 Jan 2010 21:30:23 -0500 (EST)

James,
Thank you, Mr. core-dev for the nice explanation.
That would've been my next step - offer to produce TDSDUMP.


-----Original Message-----
>From: "James K. Lowden" <jklowden AT freetds.org>
>Sent: Jan 5, 2010 8:07 PM
>To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
>Subject: Re: [freetds] Problem with connection.
>
>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 mailing list
>FreeTDS AT lists.ibiblio.org
>http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page