procedure to upgrade or create an embedded database

2008-12-06 Thread Brian Peterson
I'm trying to figure out how to determine what connection parameters for an
embedded database I should use when there might not be a database in place
(so "create=true"), or there might be an older version already in place (so
"upgrade=true"), or there might already be a database of the right version
in place (so "create" or add nothing to the URL).

I read that "upgrade" and "create" cannot both be specified in the
connection URL. If I'm putting out a release of my application that uses the
latest version of Derby (10.4) while a previous version used 10.2.2, what
are the recommended steps for making the connection to the Derby database if
one is already present? (Note that I have to handle this programmatically as
part of the application startup.)

Do I first try a URL with "create" and see if there's an error, and if so,
follow up with a call with "upgrade"? Or do I have the procedure always use
"upgrade" and follow up with a URL with "create" if it fail to make a
connection?

Brian





Re: Urgent : Problem in booting up the database using Derby

2008-12-06 Thread Øystein Grøvlen



Emmanuel Cecchet wrote:

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.




No, if you do not specify a database, all booted databases and the 
database engine will be shut down.


--
Øystein



Re: Urgent : Problem in booting up the database using Derby

2008-12-06 Thread Emmanuel Cecchet

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 ., 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.(Unknown Source)
 at org.apache.derby.impl.jdbc.EmbedConnection30.(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(DriverManagerDataSource.java:81)
 at 
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:96)
 at 
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:89)
 at 
com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:665)
 at 
com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResourcePool.java:32)
 at 
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1204)
 at 
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:368)
*Caused by: java.sql.SQLException: Another instance of Derby may have 
already booted the database..*
 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 .*
 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 
o

Urgent : Problem in booting up the database using Derby

2008-12-06 Thread Kamesh Parameswaran
Hello All,
 
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");
 
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,mai
n] Cleanup action starting
java.sql.SQLException: Failed to start database ., 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.(Unknown Source)
 at org.apache.derby.impl.jdbc.EmbedConnection30.(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(DriverManagerDataS
ource.java:81)
 at
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(Wrap
perConnectionPoolDataSource.java:96)
 at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0Pool
edConnectionPool.java:89)
 at
com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool
java:665)
 at
com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResourcePool.j
ava:32)
 at
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourceP
ool.java:1204)
 at
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolA
synchronousRunner.java:368)
Caused by: java.sql.SQLException: Another instance of Derby may have already
booted the database..
 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 .
 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(Unk
nown 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(Unkn
own Source