Hi Paul,

I'm going to assume you're on a Linux system. I have exactly that configuration on my system (name to ip address mapping in /etc/hosts) and here's my understanding of how it's supposed to work:

DBI uses a database driver (DBD).  DBD uses the database client libraries. In 
my case MySQL, in yours, sybase.

The client libraries, have hooks into routines in glibc called the resolver library. Usually those are configured by the file /etc/nsswitch.conf. Those routines allow the the client library to resolve name to ip address mappings and vice versa and the order of services to follow for resolution.

Some db client libraries, like Informix, have their own configuration files 
that have to correct, but ultimately use the glibc resolution library.

If ping <hostname> correctly finds the address in /etc/hosts, the system 
resolver is functioning correctly.  If not, check the order specified in 
nsswitch.conf.

Usually the order is files then dns. It doesn't have to be. If you see dns then files, the configured dns server will take precedence and /etc/hosts might not be checked at all... Especially if dns returns an IP address for the host name you're trying to use. Changes to nsswitch.conf are instant.

On some systems an interesting little "cache" daemon called nscd (name service cache daemon) might be present to muddy the waters. If nscd is running it will intercept resolution calls and return the last thing it knew, making a liar of me (changes are instant). If nscd is running, stop, or restart the nscd service after making changes to nsswitch.conf

I HAVE seen one instance where nsswitch.conf was a zero length file. This is EXTREMELY non-standard. Much hilarity ensued for some time trying to find out why localhost didn't resolve... It was in /etc/hosts!!!!

I'm sure any mistakes I may have made here WILL be called out, post hasty, but 
this is my understanding.

Bruce

On 06/01/2017 01:08 PM, Paul M via beginners wrote:
I have a hosts entry that points to a specific IP address. It does not appear 
that DBI:Sybase:server uses the /etc/hosts file? Is this correct?
Ping works fine in shell.
How would I point a server name to different IP addresses locally?
What does DBI use for name resolution?

Thanks!

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to