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 determine database server hostname from Connection 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 "determine database server hostname from Connection" Watch "determine database server hostname from Connection" New topic
Author

determine database server hostname from Connection

Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
    
    1
I have a java.sql.Connection object, and I need to determine the hostname of the database server. Is there any way to extract this information somehow? Even to retrieve the JDBC URL would be helpful.

Thanks
Geoffrey


Sun Certified Programmer for the Java 2 Platform
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

Connection.getMetaData()


My Blog: Down Home Country Coding with Scott Selikoff
Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
    
    1
... specifically,



Thanks!
Geoffrey
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: determine database server hostname from Connection
 
Similar Threads
Is Database location an option in properties file ?
GUI question
local vs networked mode
Error in connecting to database
NX: suncertify.properties