db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Ruehlicke" <BRuehli...@lgc.com>
Subject Shutdown and reconnection results in "No suitable Driver"
Date Fri, 25 Feb 2005 21:04:14 GMT
Here a strange situation. I have a main JVM which has a Derby Embedded
connection. It spinns off to call a script which again will make a Derby
Connection. To allow this Embedded I have to disconnect from Derby in
the first JVM. It turned out I had to use Shutdown in th efirsyt to let
the second jvm allow to connect
// shutting down a database from your application
So far so good. Now when JVM number one want to reestablish it's
connection via the usual Class.forName(...) ...
I get
a java.sql.SQLException: No suitable Driver 
I have created a JUnit test which simply just Loops over a connection ,
a shutdown and a new connection - it fails with the 2. connection. see
code snipled below. Trust me that the url is correct and that the first
time it goes via the loop it connect correctly.
Any thoughts ?!!
         for(int tal=0;tal<10;tal=tal+1)
             System.out.println("Running for number : "+tal);
             System.out.println("Loaded the appropriate driver.");
             _connection = DriverManager.getConnection(url +
";create=true", user, pass);

where tearDown() is
     protected void tearDown()
             // Now try to disconnect
             _connection = null;
             System.out.println("Closed connection");
                In embedded mode, an application should shut down Derby.
                If the application fails to shut down Derby explicitly,
                the Derby does not perform a checkpoint when the JVM
shuts down, which means
                that the next connection will be slower.
                Explicitly shutting down Derby with the URL is
                This style of shutdown will always throw an "exception".
             boolean gotSQLExc = false;
             catch(SQLException se)
                 gotSQLExc = true;
                 _logger.fine("Database did not shut down normally");
                 _logger.fine("Database shut down normally");
         catch (Throwable e)
             _logger.fine("exception thrown:"+e.getMessage());
         System.out.println("TestDerby finished");


  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message