Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
542 views
in Technique[技术] by (71.8m points)

jdbc - How to get database url from java.sql.Connection?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Connection has the getMetaData() to return DatabaseMetaData . DatabaseMetaData has the getURL() to return the URL for this DBMS.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...