Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果 JDBC 数据库正在运行,例如jdbc:hsqldb:mem:testdb或任何其他非内存数据库:我如何System.out.println()获取数据库的 URL?
jdbc:hsqldb:mem:testdb
System.out.println()
(我知道我可以在持久性中查找它,我想从代码中打印它而不是通过阅读persistence.xml)
尝试调用getMetaData()返回包含getURL方法的 DatabaseMetaData 的 Connection 实例。
getMetaData()
getURL