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 21:47:37 GMT
Hi Knut,
Yes thats where I need this to apply.
But the problem is how can I access the InternalDriver or EmbedConnection in
BaseDataFileFactory where it is in the top level of the execution stack.
Here is the stack trace of the execution

org.apache.derby.impl.store.raw.data.BaseDataFileFactory.stop(BaseDataFileFactory.java:464)
org.apache.derby.impl.services.monitor.TopService.stop(TopService.java:442)
org.apache.derby.impl.services.monitor.TopService.shutdown(TopService.java:393)
org.apache.derby.impl.services.monitor.BaseMonitor.shutdown(BaseMonitor.java:239)
org.apache.derby.impl.db.DatabaseContextImpl.cleanupOnError(DatabaseContextImpl.java:62)
org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(ContextManager.java:333)
org.apache.derby.impl.jdbc.TransactionResourceImpl.cleanupOnError(TransactionResourceImpl.java:419)
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:626)
org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:73)
org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:54)
org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:68)
org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:238)
org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:119)
java.sql.DriverManager.getConnection
java.sql.DriverManager.getConnection


Do I need to parse it as a parameter?
Thanks
Eranda
On Thu, Apr 15, 2010 at 2:33 AM, Knut Anders Hatlen <Knut.Hatlen@sun.com>wrote:

> On 04/14/10 22:15, Eranda Sooriyabandara wrote:
> > 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.
>
> Hi Eranda,
>
> It should be possible to call EmbedConnection.getDBName() from within
> the code as well, if a connection has been created. But exactly how to
> get the database name depends on where in the code you need to get it
> from. Is this question about DERBY-4601? If so, I guess that means
> you'll want to get it from InternalDriver and/or EmbedConnection. In
> InternalDriver, you typically have the URL and need to call the helper
> method getDatabaseName() to extract the name. In EmbedConnection, you
> can simply call getDBName() or tr.getDBName().
>
> --
> Knut Anders
>

Mime
View raw message