3

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?

1 Answer 1

5

Connection.getMetaData().getURL() or one of the other methods such as DatabaseMetadata.getDriverName() will give you information about the database connection.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.