You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Dmitri Pissarenko <dm...@gmail.com> on 2007/06/12 19:03:17 UTC

Shutting down built-in Derby

Hello!

I'm using Derby database, which is delivered together with Java 1.5/1.6.

One of my applications crashed without closing the connection to Derby
and I get following exception:

 [emmajava] java.sql.SQLException: Failed to start database 'xe', see
the next exception for details.
 [emmajava] at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
 [emmajava] at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
 [emmajava] at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
 [emmajava] at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
Source)
 [emmajava] at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown
Source)
...

How can I close Derby database manually after a crash (except
rebooting the machine) ?

TIA

Dmitri Pissarenko
-- 
http://www.xing.com/profile/Dmitri_Pissarenko
http://dapissarenko.blogspot.com/

Re: Shutting down built-in Derby

Posted by Dmitri Pissarenko <dm...@gmail.com>.
Hello!

I tried to do this:

   public static void shutDownDerbyAfterCrash()
   {
      try
      {
         Driver driver = null;

         driver = (Driver)Class.forName(DRIVER).newInstance();
         DriverManager.registerDriver(driver);
         DriverManager.getConnection("jdbc:derby:;shutdown=true");
      }
      catch (Exception exception)
      {
         logger.error("", exception);
      }
   }

but I'm still getting the same error.

Best regards

Dmitri Pissarenko
-- 
http://www.xing.com/profile/Dmitri_Pissarenko
http://dapissarenko.blogspot.com/

Re: Shutting down built-in Derby

Posted by Dmitri Pissarenko <dm...@gmail.com>.
Hello!

Thanks for your answer!

> maybe you can:
> 1.make sure no ij is currently running

What is an ij?

> 2.check if there are any threads keeping the connection to Derby is running

How can I do it?

TIA

Dmitri Pissarenko
-- 
http://www.xing.com/profile/Dmitri_Pissarenko
http://dapissarenko.blogspot.com/

Re: Shutting down built-in Derby

Posted by Tony Winslow <to...@gmail.com>.
maybe you can:
1.make sure no ij is currently running
2.check if there are any threads keeping the connection to Derby is running

2007/6/13, Dmitri Pissarenko <dm...@gmail.com>:
>
> Hello!
>
> Thanks for your answer!
>
> On 6/12/07, Jose de Castro <jo...@voxeo.com> wrote:
> > Dmitri, you seem to ave truncated the root cause. Can you please provide
> > the entire exception chain?
>
> Yes.
>
> ERROR XSDB6: Another instance of Derby may have already booted the
> database C:\work\business\prog\mycompany\sw\myprogram\xe.
>         at org.apache.derby.iapi.error.StandardException.newException(Unknown
> Source)
>         at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB
> (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.getJBMSLockOnDB
> (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(Unknown
> 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(Unknown
> 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(Unknown
> 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.startProviderService
> (Unknown
> Source)
>         at
> org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService
> (Unknown
> Source)
>         at
> org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService
> (Unknown
> Source)
>         at
> org.apache.derby.iapi.services.monitor.Monitor.startPersistentService
> (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 java.sql.DriverManager.getConnection(Unknown Source)
>         at java.sql.DriverManager.getConnection(Unknown Source)
>         at
> com.mycompany.myprogram.database.DerbyConnection.connectToDatabase(
> DerbyConnection.java:52)
>         at
> com.mycompany.myprogram.database.DatabaseConnection.getDatabaseConnection(
> DatabaseConnection.java:30)
>         at com.mycompany.myprogram.myprogram.setupDatabaseConnection(
> myprogram.java:103)
>         at com.mycompany.myprogram.myprogram.run(myprogram.java:53)
>         at com.mycompany.myprogram.myprogram.main(myprogram.java:128)
>
> Best regards
>
> Dmitri Pissarenko
> --
> http://www.xing.com/profile/Dmitri_Pissarenko
> http://dapissarenko.blogspot.com/
>

Re: Shutting down built-in Derby

Posted by Dmitri Pissarenko <dm...@gmail.com>.
Hello!

Thanks for your answer!

On 6/12/07, Jose de Castro <jo...@voxeo.com> wrote:
> Dmitri, you seem to ave truncated the root cause. Can you please provide
> the entire exception chain?

Yes.

ERROR XSDB6: Another instance of Derby may have already booted the
database C:\work\business\prog\mycompany\sw\myprogram\xe.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(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.getJBMSLockOnDB(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(Unknown
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(Unknown
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(Unknown
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.startProviderService(Unknown
Source)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown
Source)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown
Source)
	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(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 java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at com.mycompany.myprogram.database.DerbyConnection.connectToDatabase(DerbyConnection.java:52)
	at com.mycompany.myprogram.database.DatabaseConnection.getDatabaseConnection(DatabaseConnection.java:30)
	at com.mycompany.myprogram.myprogram.setupDatabaseConnection(myprogram.java:103)
	at com.mycompany.myprogram.myprogram.run(myprogram.java:53)
	at com.mycompany.myprogram.myprogram.main(myprogram.java:128)

Best regards

Dmitri Pissarenko
-- 
http://www.xing.com/profile/Dmitri_Pissarenko
http://dapissarenko.blogspot.com/

Re: Shutting down built-in Derby

Posted by Jose de Castro <jo...@voxeo.com>.
Dmitri, you seem to ave truncated the root cause. Can you please provide 
the entire exception chain?

Dmitri Pissarenko wrote:
> Hello!
>
> I'm using Derby database, which is delivered together with Java 1.5/1.6.
>
> One of my applications crashed without closing the connection to Derby
> and I get following exception:
>
> [emmajava] java.sql.SQLException: Failed to start database 'xe', see
> the next exception for details.
> [emmajava] at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
> [emmajava] at 
> org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source)
> [emmajava] at 
> org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source)
> [emmajava] at 
> org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
> Source)
> [emmajava] at 
> org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown
> Source)
> ...
>
> How can I close Derby database manually after a crash (except
> rebooting the machine) ?
>
> TIA
>
> Dmitri Pissarenko