db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Watler <wat...@wispertel.net>
Subject Accessing embedded Derby in forked Maven2 build
Date Mon, 13 Mar 2006 20:36:44 GMT
All,

I am running into difficulties finding a way to shutdown a Derby 
database, (10.1.1.0), from within an Ant build invoked from Maven2. I 
need to do this to release a database lock for the running JVM so that 
subsequently forked tests in their own JVMs can access the database. 
Here is what I tried:

        <!--
            Tests will be executed in forked JVM process while this
            Ant build is executed in the main Maven process; the Derby
            embedded database must be shutdown to prevent JVM instance
            level locking that would prevent the tests from running
        -->
        <sql url="jdbc:derby:/tmp/testdb;shutdown=true"
             driver="org.apache.derby.jdbc.EmbeddedDriver" 
             userid="" password=""
             onerror="continue" >
            <classpath>
                <fileset refid="derby.embedded.db.dependencies.id"/>
            </classpath>
            -- SHUTDOWN DERBY EMBEDDED DATABASE TO FREE JVM LOCK 
        </sql>

Unfortunately, the onerror attribute does not apply to the initial 
connection establishment phase, just the execution of SQL statements. 
This task resulted in the following error:

Embedded error: The following error occurred while executing this line:
C:\jetspeed-2\etc\build.xml:258: The following error occurred while executing this line:
C:\jetspeed-2\etc\build.xml:357: SQL Exception: Database '/tmp/testdb' shutdown.

What I'd really like to have is an SQL statement I can execute to 
perform the shutdown. Barring that, finding a way to avoid throwing the 
connect SQLException might also work. A Derby Ant task to perform the 
shutdown would be very handy as well if it is available in the Derby 
distribution. Are any of these or other options available that I might try?

I'd really like to find a way to shutdown the database from Ant. This 
approach fits the general architecture of the existing Jetspeed2 build. 
Because we have not needed to delve into custom Ant tasks or Maven2 
plugins to date, I'd rather not go there either.

Thanks for any input you can provide in advance,

Randy Watler, (Jetspeed 2 committer)


Mime
View raw message