Re: Problem with connection.

[email protected]
Newsgroups gmane.comp.db.tds.freetds
Message-ID <19441965.1262745023508.JavaMail.root@mswamui-cedar.atl.sa.earthlink.net>
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" <[email protected]>
>Sent: Jan 5, 2010 8:07 PM
>To: FreeTDS Development Group <[email protected]>
>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
>[email protected]
>http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.