Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 42940 invoked from network); 25 Feb 2005 21:34:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Feb 2005 21:34:11 -0000 Received: (qmail 46443 invoked by uid 500); 25 Feb 2005 21:34:10 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 46426 invoked by uid 500); 25 Feb 2005 21:34:10 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 46411 invoked by uid 99); 25 Feb 2005 21:34:10 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from junior.lgc.com (HELO junior.lgc.com) (134.132.72.99) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 25 Feb 2005 13:34:08 -0800 Received: from lgchvw01.landmark.lgc.com (lgchvw01.lgc.com [134.132.93.107]) by junior.lgc.com (8.11.7/8.11.3) with SMTP id j1PLY7u18634 for ; Fri, 25 Feb 2005 15:34:07 -0600 (CST) Received: from 134.132.72.99 by lgchvw01.landmark.lgc.com (InterScan E-Mail VirusWall NT); Fri, 25 Feb 2005 15:34:01 -0600 Received: from HOUEXCH903.landmark.lgc.com (houexch903 [134.132.167.43]) by junior.lgc.com (8.11.7/8.11.3) with ESMTP id j1PLY2N18626 for ; Fri, 25 Feb 2005 15:34:02 -0600 (CST) Received: from HOUEXCH902.landmark.lgc.com ([134.132.167.38]) by HOUEXCH903.landmark.lgc.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 25 Feb 2005 15:33:59 -0600 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Shutdown and reconnection results in "No suitable Driver" Date: Fri, 25 Feb 2005 15:33:57 -0600 Message-ID: <1B37BEFB3456F1428E01932AFA147822E1A4F5@HOUEXCH902.landmark.lgc.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Shutdown and reconnection results in "No suitable Driver" Thread-Index: AcUbfZIQ3jU28SuJT4yhnb+1t96ObAAA4b2w From: "Bernd Ruehlicke" To: "Derby Discussion" X-OriginalArrivalTime: 25 Feb 2005 21:33:59.0302 (UTC) FILETIME=[B77C1260:01C51B81] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Maybe the question is leading to a more general question. Can I use the same Derby database instance from 2 JVM's ? The scenario would be a controlling JVM which one in a while need to connect to derby - than disconnect. While the (still running) first JVM has disconnected a second JVM will try to access the same Derby database - and releases the connection simply when the JVM ends, whereafter again the controlling JVM want to open a connection to this Derby instance. I thought by doing the shutdown this was the way - but it seams that if you first have done a shutdown once - you are done for this JVM and need to restart the JVM to be able to establish a new frsh connection. B-)=20 > -----Original Message----- > From: Bernd Ruehlicke [mailto:BRuehlicke@lgc.com]=20 > Sent: Friday, February 25, 2005 3:04 PM > To: Derby Discussion > Subject: Shutdown and reconnection results in "No suitable Driver" >=20 > Here a strange situation. I have a main JVM which has a Derby=20 > Embedded connection. It spinns off to call a script which=20 > again will make a Derby Connection. To allow this Embedded I=20 > have to disconnect from Derby in the first JVM. It turned out=20 > I had to use Shutdown in th efirsyt to let the second jvm=20 > allow to connect > =20 > // shutting down a database from your application=20 > DriverManager.getConnection( > "jdbc:derby:;shutdown=3Dtrue"); > =20 > So far so good. Now when JVM number one want to reestablish=20 > it's connection via the usual Class.forName(...) ...=20 > DriverGetConnection(url,user,passw)=20 > =20 > I get > =20 > a java.sql.SQLException: No suitable Driver=20 > =20 > =20 > I have created a JUnit test which simply just Loops over a=20 > connection , a shutdown and a new connection - it fails with=20 > the 2. connection. see code snipled below. Trust me that the=20 > url is correct and that the first time it goes via the loop=20 > it connect correctly. > =20 > =20 > Any thoughts ?!! > =20 > B-) > =20 > ..... > for(int tal=3D0;tal<10;tal=3Dtal+1) > { > Class.forName(driver); > System.out.println("Running for number : "+tal); > System.out.println("Loaded the appropriate driver."); > =20 > _connection =3D DriverManager.getConnection(url +=20 > ";create=3Dtrue", user, pass); > =20 > if(tal<9)this.tearDown(); > } >=20 > ...... > =20 > =20 > where tearDown() is > protected void tearDown() > { > try > { > // Now try to disconnect > _connection.close(); > _connection =3D null; > System.out.println("Closed connection"); > =20 > /* > In embedded mode, an application should shut=20 > down Derby. > If the application fails to shut down Derby=20 > explicitly, > the Derby does not perform a checkpoint when=20 > the JVM shuts down, which means > that the next connection will be slower. > Explicitly shutting down Derby with the URL=20 > is preferred. > This style of shutdown will always throw an=20 > "exception". > */ > boolean gotSQLExc =3D false; > =20 > try > { > =20 > DriverManager.getConnection("jdbc:derby:;shutdown=3Dtrue"); > } > catch(SQLException se) > { > gotSQLExc =3D true; > } > =20 > if(!gotSQLExc) > { > _logger.fine("Database did not shut down normally"); > } > else > { > _logger.fine("Database shut down normally"); > } > } > catch (Throwable e) > { > _logger.fine("exception thrown:"+e.getMessage()); > e.printStackTrace(); > } > =20 > System.out.println("TestDerby finished"); > =20 > } >=20 > =20 >=20