db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Get database name
Date Wed, 14 Apr 2010 08:12:59 GMT
On 04/13/10 09:50 PM, Eranda Sooriyabandara wrote:
> Hi,
> Are there any method which we can get the current database instance name?

EmbedConnection has a public method called getDBName(), but that method
can only be used if you cast the connection instance to EmbedConnection,
and it only works on the embedded driver. If you want to get the
database name through the JDBC interfaces, I think you first need to get
the connection URL,

String url = conn.getMetaData().getURL();

and then extract the database name part from the string.

Knut Anders

View raw message