db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Katherine Marsden <kmarsdende...@sbcglobal.net>
Subject Re: Disconnecting Derby and TDD
Date Fri, 13 Jul 2012 18:39:29 GMT
On 7/11/2012 10:14 PM, Matthew Hauck wrote:
> I am writing about the well known error: "Failed to start database 
> '...' with class loader ..."  I realize that you cannot have two 
> simultaneous connections from two different JVMs to a derby embedded 
> database. My question is whether or not it is possible to disconnect / 
> "unload" / "unboot" one connection in order to load up the other one, 
> etc. Or does the first JVM have to entirely stop before the next one 
> can make a connection?
> I ask for TDD reasons. One of the tests I'm trying to write (on 
> cucumber / jruby) requires some out-of-process testing. i.e. I have 
> one process (cucumber) invoking the tests, which requires the spawning 
> of another process. I would like the parent process to be able to turn 
> off its connection to the embedded database (without shutting down), 
> such that it can allow the spawned process to access the database, and 
> then turn it back on and make sure things went as planned after the 
> other process completes.
> Is this possible?
You can shutdown a single database without exiting the JVM using the 
shudown=true  attribute if using a DriverManager connection:
or with the DataSource property shutdownDatabase()

This will allow another jvm to boot the database. Then then after the 
spawned process completes,  first jvm can reconnect which will reboot 
the database.



View raw message