Skip to Content.
Sympa Menu

freetds - Re: [freetds] INT_EXIT error returned for msgno 20009

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "J.A." <und3r53v3n AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] INT_EXIT error returned for msgno 20009
  • Date: Tue, 1 Nov 2011 11:11:54 -0400

Is there a way I can define the port?

On Mon, Oct 31, 2011 at 9:21 PM, James K. Lowden <jklowden AT freetds.org>wrote:

> On Mon, 31 Oct 2011 13:43:47 -0400
> "J.A." <und3r53v3n AT gmail.com> wrote:
>
> > I'm using Gnu C to attempt to connect to a MS Sqlserver 2008
> > instance. I have a freetds.conf file that successfully connects
> > using tsql. I checked the log and it was not present. This leads me
> > to believe the problem is my code is not using the config file (which
> > apparently works).
> >
> > how do I make my code use the config file?
>
> Your freetds.conf is not read by dbinit(); it's consulted when you
> call dbopen().
>
> > I am getting the following error when I run my code:
> > FreeTDS: db-lib: exiting because client error handler returned
> > INT_EXIT for msgno 2 0009
>
> Oof, what a little whitespace can do to the meaning of a message!
> There is no msgno 2, which at first confused me. But there is a msgno
> 20009:
>
> $ grep 20009 include/sybdb.h
> #define SYBECONN 20009 /* Unable to connect socket -- SQL
> Server is unavailable or does not exist. */
>
> So I think your error stems from dbopen(), not dbinit(). If you
> install your error handler before calling dbopen() (as you should) you
> can choose *not* to return INT_EXIT. For more information, look for
> the word "saith" in src/dblib/dblib.c.
>
> Try the same server with bsqldb or t0001. These programs install an
> error handler and print a more useful message, e.g.:
>
> $ build/src/dblib/unittests/t0001 -S localhost
> found localhost.FreeTDS for jkl in "../../../PWD"
> About to logon as "jkl"
> About to open "localhost"
> DB-LIBRARY error (dberr 20009 (severity 9): "Unable to connect:
> Adaptive Server is unavailable or does not exist"; oserr 61:
> "Connection refused")
>
> 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