db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kim Haase <Camilla.Ha...@Sun.COM>
Subject Multiple database reboots in a single program?
Date Tue, 16 Oct 2007 14:47:19 GMT
While working on a fix for DERBY-1823 (a documentation issue concerning 
user authentication and authorization), I've tried to write a sample 
Java program that connects to a database using the embedded driver, does 
some things, shuts it down, starts it up, does some more things, shuts 
it down again, and so on. I always get an error trying to connect to the 
database the second time, although I've followed the advice in "Shutting 
down the system" 
(http://db.apache.org/derby/docs/dev/devguide/tdevdvlp20349.html) to run 
System.gc() between the first shutdown and the restart so as to unload 
the embedded driver.

I've attached a simplified version of the program, one that just does 
the repeated startups and shutdowns.  The error is shown below. What am 
I doing wrong?

If I break up all my steps into 5 smaller programs, they all work fine, 
because there's only one startup and shutdown per program. But it would 
be handier to be able to combine them in one.

Thanks,
Kim Haase

-----------

179 =>java SimpleExample
org.apache.derby.jdbc.EmbeddedDriver loaded.
Trying to connect to jdbc:derby:jdbcDemoDB;create=true
Connected to database jdbc:derby:jdbcDemoDB;create=true
Closed connection
Database shut down normally
org.apache.derby.jdbc.EmbeddedDriver loaded.
Trying to connect to jdbc:derby:jdbcDemoDB

---SQLException Caught---

SQLState:   null
Severity: 0
Message:  org.apache.derby.jdbc.EmbeddedDriver is not registered with 
the JDBC driver manager
java.sql.SQLException: org.apache.derby.jdbc.EmbeddedDriver is not 
registered with the JDBC driver manager
         at 
org.apache.derby.jdbc.AutoloadedDriver.getDriverModule(Unknown Source)
         at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:193)
         at SimpleExample.main(SimpleExample.java:74)

Mime
View raw message