File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes tcp/ip address v. DNS name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "tcp/ip address v. DNS name" Watch "tcp/ip address v. DNS name" New topic
Author

tcp/ip address v. DNS name

Dave Segal
Greenhorn

Joined: Aug 13, 2002
Posts: 20
I need to compare the Connection used by a DataSource against a set of DriverManager parameters to determine if they are "equivalent". I do this by comparing the hostname, datbasename, and port. My problem is that I am given the DriverManager parameter DNSname but when I retrieve the hostname from the DataSource Connection, I am given the TCP/IP address.

Can anybody tell me how to translate the DNSName into it's TCP/IP address so that I can compare on these properties?
Paul Misoni
Greenhorn

Joined: Jan 02, 2001
Posts: 16
To resolve the IP address to then DNS name, ping with the -a argument.

example: ping -a 64.78.181.41

If it can resolve the address, it will return:

Pinging tut.ejip.net

Of course, this doesn't work well the other way, as multiple DNS names can point to the same IP address.

Hope this helps somewhat.
 
Consider Paul's rocket mass heater.
 
subject: tcp/ip address v. DNS name
 
Similar Threads
DriverManager and Datasource.
Getting CommunicationException
IP Address as a hostname string !
How to Give Permissions for postgresdb to our localsystem.
Help: Connecting Tomcat to CA-IDMS Using JDBC Type 4 Drivers (JNDI / IDMSDataSource)