Emanuel,
I could see the database and the instance of Derby get shutting down. I've
tried by giving my database URL too. But the result is same though.
DriverManager.getConnection("jdbc:derby:;shutdown=true"); is used to
shutdown the entire system of Derby (Derby+Database). Please correct me If
I'm wrong. Because I've tried all the combinations and couldn't achieve the
result which I expect.
Thanks,
Kamesh
-----Original Message-----
From: Emmanuel Cecchet [mailto:[EMAIL PROTECTED]
Sent: Saturday, December 06, 2008 8:21 PM
To: Derby Discussion
Cc: [EMAIL PROTECTED]
Subject: Re: Urgent : Problem in booting up the database using Derby
Kamesh,
> I'm suffering a weird kind of a problem while running my JUnit Test
> Cases against a database which uses derby as an engine.
> Once after each test case gets completed I'm shutting down the
> database and derby using the following piece of code
>
> DriverManager.getConnection("jdbc:derby:;shutdown=true");
Are you not supposed to provide the database name in the URL? It looks like
it is missing here.
Emmanuel
>
> I'm running a batch of test cases at a fly using the JUnit option
> available in Apache ANT, from Command Line mode. There are eleven test
> cases in my Batch. Since my test cases make use of hibernate to boot
> up derby as well as the database, I don't have to worry about starting
> it up. It is done in embedded mode. I have to be worried about
> shutting down the derby instance and db properly. The problem is, the
> first 3 test cases start up and shutdown the derby and db properly,
> but when the fourth test case tries to boot up the db I'm getting the
> following error ,
>
> ======================================================================
> =============================================
> 2008-12-06 05:24:47.154 GMT
> Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2
> ,5,main]
> Cleanup action starting
> *java.sql.SQLException: Failed to start database <db-name>., see the
> next exception for details.
> * at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source) at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown
> Source) at
> org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
> at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
> at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown
> Source) at org.apache.derby.jdbc.InternalDriver.connect(Unknown
> Source) at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown
> Source) at
> com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManage
> rDataSource.java:81)
> at
> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnectio
> n(WrapperConnectionPoolDataSource.java:96)
> at
> com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3
> P0PooledConnectionPool.java:89)
> at
> com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResour
> cePool.java:665)
> at
> com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResource
> Pool.java:32)
> at
> com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicRes
> ourcePool.java:1204)
> at
> com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(Threa
> dPoolAsynchronousRunner.java:368) *Caused by: java.sql.SQLException:
> Another instance of Derby may have already booted the
> database<db-name>..* at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
> Source) ... 13 more *Caused by: ERROR XSDB6: Another instance of
> Derby may have already booted the database <db-name>.* at
> org.apache.derby.iapi.error.StandardException.newException(Unknown
> Source)
> at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLo
> ckOnDB(Unknown
> Source)
> at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown
> Source)
> at java.security.AccessController.doPrivileged(Native Method) at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOn
> DB(Unknown
> Source)
> at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown
> Source)
> at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
> at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
> at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source) at
> org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
> at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
> at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
> Source)
> at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
> at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
> at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
> at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source) at
> org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.BaseMonitor.startProviderServic
> e(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStar
> tService(Unknown
> Source)
> at
> org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentServ
> ice(Unknown
> Source)
> at
> org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(
> Unknown
> Source)
> ... 13 more
>
> ======================================================================
> ==============================================
>
>
>
>
> But the third test case has shutdown the db as well as the derby.. The
> hibernate log shows,
>
> *2008-12-06 10:55:52,169 ERROR [main] (JDBCExceptionReporter.java:78)
> - Connections could not be acquired from the underlying database!*
> **
> **
> **
> I've totally no idea about what is going inside the derby. If it is
> able to start it up and shut it down for three consecutive times then
> why its not able to do the same for the upcoming runs. The starting up
> and shutting down is done internally in the test case , and the test
> cases are run in a batch mode using JUnit. So no way I'm stopping the
> tests in the middle. Derby and database have to be started up and
> shutdown 11 times consecutively since I've 11 cases in my JUnit task.
> If anyone could shed some lights on the issue it'd be helpful for me
> to proceed further.
>
>
> Thanks in Advance,
>
> Kamesh P G.
--
Emmanuel Cecchet
FTO @ Frog Thinker
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: [EMAIL PROTECTED]
Skype: emmanuel_cecchet