db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eranda Sooriyabandara <erandaj...@gmail.com>
Subject Re: Get database name
Date Wed, 14 Apr 2010 20:15:37 GMT
Hi Knut,
Thanks. Also is there a way to get the current database name within the
code?
The purpose is to print the current database name to the log.
Thanks
Eranda

On Wed, Apr 14, 2010 at 1:42 PM, Knut Anders Hatlen <Knut.Hatlen@sun.com>wrote:

> 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
>
>

Mime
View raw message