Skip to Content.
Sympa Menu

freetds - Re: [freetds] fix for spurious server not found in configuration file

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] fix for spurious server not found in configuration file
  • Date: Sun, 22 Nov 2009 16:55:07 -0500

Christos Zoulas wrote:
>
> I really don't want to list > 50 servers in my freetds.conf file to
> avoid seeing the message:
>
> Msg 20012, Level 2, State -1, Server OpenClient, Line -1
> Server name not found in configuration files.

I tried something a little different. Tell me what you think.

Name lookup worked thus:

1. find logical name in config files, else
1a. TDSEINTF and
2. convert name to ip address with inet_addr(3), else
3. gethostbyname(3), else
4. gethostbyname(3) for "SYBASE", else
5. give up.

and step 1a was your complaint. The idea was to indicate to the user that
the provided name couldn't be looked up.

A regularly occurring problem on the ML, and a source of confusion, is the
message in the log

12:15:56.895106 IP address pointer is NULL
12:15:56.895122 Server SYBASE not found!

I put quite a lot of time into clearifying messages about name lookup,
connection, and login problems. I added TDSEINTF so that a user would
know that, well, that the servername wasn't in his freetds.conf.

But I see I was overzealous, because you configure your library for the
right version of TDS for your environment and rely on simple DNS lookup.
(Clever!) So I changed the logic:

1. find logical name in config files, else
2. convert name to ip address with inet_addr(3), else
3. gethostbyname(3), else
4. gethostbyname(3) for "SYBASE", else
4a. TDSEINTF and
5. give up.

In other words, don't emit TDSEINTF unless no IP address could be
determined.

Here are some situations and their associated messages:

# invalid name, error from library
$ ./build/src/apps/bsqldb -S nobody -U none -P none
bsqldb: Msg 20012, Level 2
Server name not found in configuration files

bsqldb: Msg 20013, Level 2
Unknown host machine name

# valid DNS name, no server, error from library
$ ./build/src/apps/bsqldb -S thistle -U none -P none
bsqldb: Msg 20009, Level 9
Unable to connect: Adaptive Server is unavailable or does not exist

# valid DNS name, bad login, used to report servername as "SYBASE"
# error from server
$ ./build/src/apps/bsqldb -S goodname -U none -P none
Msg 18456, Level 14, State 1
Server '[goodname]',
Login failed for user 'none'.
bsqldb: error: severity 14 > 10, exiting

# valid login, ordinary server message
$ ./build/src/apps/bsqldb -S goodname -U $U -P $P <<<
'raiserror("something went wrong", 16,1)'
Msg 50000, Level 16, State 1
Server 'TITAN', Line 1
something went wrong
bsqldb: error: severity 16 > 10, exiting

Note how the reported servername changes to to the server's self-reported
name once the user has logged in. (We use the requested servername for
login errors because Microsoft servers don't seem to report a servername
in AA packets.)

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page