简体   繁体   English

如何获取获取JDBC连接的URL字符串

[英]how to get get the JDBC connection url string

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. 我的库使用一个jdbc连接对象,并且我需要为不同的连接(可能是到不同的数据库)支持一些不同的元数据,所以我认为可以将连接URL字符串用作地图的键,但找不到它。

Is there any way to get the connection URL string from a connection object? 有什么方法可以从连接对象获取连接URL字符串吗?

Connection.getMetaData().getURL()或其他方法之一(例如DatabaseMetadata.getDriverName()将为您提供有关数据库连接的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM