Re: INT_EXIT error returned for msgno 20009
"J.A." <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAEbQPJe5vs3Ou_BTkpBQiu1HqDqrOskPcE5u60mVzv7P0cNVZw@mail.gmail.com> |
Is there a way I can define the port? On Mon, Oct 31, 2011 at 9:21 PM, James K. Lowden <[email protected]>wrote: > On Mon, 31 Oct 2011 13:43:47 -0400 > "J.A." <[email protected]> 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 > [email protected] > http://lists.ibiblio.org/mailman/listinfo/freetds >