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: Fernando <fer.pantaneiro AT gmail.com>
  • To: ikorot AT earthlink.net, FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problem with connection.
  • Date: Wed, 13 Jan 2010 15:22:39 -0300

Hi James, ikorot

Sorry to replay now, I've take some days-off :-)..

My applications is working fine now. What I did was just compile wiht
enable-msdblib=yes and change my code to use the freetds.conf file.

Thanks for the answers.

Ps. I have one more question. I have to bind a int64 (long) data, and
looking through the headers files, I can't find something like
"DBINT64".
I've looked at tds_sysdep_public.h file and i found this:

#define tds_sysdep_int64_type long

but in the sybdb.h file, there is no typedef for this, only

typedef tds_sysdep_int32_type DBINT;

So my question is: Can I put this typedef tds_sysdep_int64_type
DBINT64 in the sybdb.h? or use the SYBINT8 type??

Best regards,
Fernando

That's what FreeTDS does
if it was compiled with enable-msdblib=no (the default case).

On Tue, Jan 5, 2010 at 11:30 PM, <ikorot AT earthlink.net> wrote:
> 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
>
> _______________________________________________
> 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