For given Connection
instance how do I find out url that the Connection
uses to connect the database ? Is it somewhere in Properties
returned by Connection.getClientInfo()
method?
If there you need me to provide clearer description all comments are welcome. Thank you
The DatabaseMetaData#getURL Method In the above example, we first obtain the Connection instance. Then, we call the getMetaData method on our Connection to get the DatabaseMetaData. Finally, we call the getURL method on the DatabaseMetaData instance. As we'd expect, it returns the URL of our database.
A database connection URL is a string that your DBMS JDBC driver uses to connect to a database. It can contain information such as where to search for the database, the name of the database to connect to, and configuration properties.
Connection
has the getMetaData()
to return DatabaseMetaData
. DatabaseMetaData
has the getURL()
to return the URL for this DBMS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With