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
Calling Windows Subsystem for Linux Apps Through Powershell/Cmd
Tensorflow Recommended System Specifications
Data Pointers in Inode Data Structure
Windows <Sys/File.H> Equivalent
What Is The Mutex Acquire and Release Order
Gatttool: Limited to 5 Connections
Graphics Card Memory Usage in Linux
How to Get Wget Only Save File If Its Complete
Linux Mail Adding Content Type Headers Not Working
X11 Forwarding Through Google Colab
Installing Zlib in Linux Server
Undefine Reference for Libraries, So How Could I Find The Right Path
How to Display Nc Return Value in Linux Shell Script
When Is The System Call Set_Tid_Address Used
Linux User Space Threads, Kernel Threads, Lightweight Processes
Counting Number of Files in Multiple Subdirectories from Command Line