I have my application on Tomcat with a JNDI datasource. I need to access the connection string from it. Is there a way to do that in my application?
You can try the following:
DataSource ds ...
Connection conn = ds.getConnection();
DatabaseMetadata dbmd = conn.getMetaData();
System.out.println(dbmd.getURL());
You can get more info of DataBaseMetadata chedk this:
http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.