Process-Local Override of Name Resolution

process-local override of name resolution?

LD_LIBRARY_PATH for the win!

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

Also:
What is the LD_PRELOAD trick?

Also:
http://www.linuxjournal.com/article/7795

How to configure hostname resolution to use a custom DNS server in Java?

Java 9 removed this capability. You will need to use a third party DNS client library.

If you are using Java 8 or older you can do:

You can set the system property sun.net.spi.nameservice.nameservers as documented by this site.

Does host file overrides DNS for SQLConnection?

Yes, the hosts file overrides anything that uses name resolution, including the SQL client (which uses standard DNS resolution).

UPDATE

If you don't present a FQDN (as you did not in your sample), then depending on the operating system(s) and the network configuration involved it may fall back to NetBIOS name resolution. This is an old broadcast related method of resolving host names to IP addresses (it's like screaming "Hey BOB!" in your office and waiting for Bob to respond to you). I wouldn't lean on this, but it can explain why it still seems to work when you put an invalid name in the hosts file.

Override localhost on Windows XP

This is snippet from Windows hosts file:

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

In other words, handling of localhost is hard-coded into Windows DNS stack, and your attempts to override that will be ignored.



Related Topics



Leave a reply



Submit