Reputation: 9472
I don't know why I can't find this. My library takes a jdbc connection object and I need to support some different meta-data for different connections (which may be to different databases) so I figure I could use the connection URL string as the key for my map but I can't find it.
Is there any way to get the connection URL string from a connection object?
Upvotes: 3
Views: 3730
Reputation: 2017
Connection.getMetaData().getURL()
or one of the other methods such as DatabaseMetadata.getDriverName()
will give you information about the database connection.
Upvotes: 5