Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
10.6.2.1
-
None
-
Windows 7
-
Normal
Description
When looking for duplicate issue before raising, I found DERBY-540 which was closed out a while back - not sure if related
I've tried many versions of loading db from both classpath and jar
1) From Classpath
connection = DriverManager.getConnection("jdbc:derby:directory:/myDb");
connection = DriverManager.getConnection("jdbc:derby:directory:myDb");
connection = DriverManager.getConnection("jdbc:derby:/myDb");
connection = DriverManager.getConnection("jdbc:derby:mtDb");
2) From jar on classpath
connection = DriverManager.getConnection("jdbc:derby:myDb");
connection = DriverManager.getConnection("jdbc:derby:/myDb");
connection = DriverManager.getConnection("jdbc:derby:memory:myDb"); //load from classpath jar into memory
connection = DriverManager.getConnection("jdbc:derby:/myDb"); //load from classpath jar into memory
3) From non classpath jar - THESE WORK!!
connection = DriverManager.getConnection("jdbc:derby:jar:(C:/myDb.zip)myDb");
connection = DriverManager.getConnection("jdbc:derby:jar:(C:/myDb.zip)/myDb");
Unfortunately I couldn't get classpath based loading to work - I verified the zip was on the classpath and successfully loaded resources from it using:
Thread.currentThread().getContextClassLoader.getResourceAsStream(....)
Error stack trace is typically:
java.sql.SQLException: Database 'myDb' not found.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:572)
at java.sql.DriverManager.getConnection(DriverManager.java:218)
at com.s1.sweeping.persistence.jdbc.DerbyPersistorIntegrationTest.setUpOnce(DerbyPersistorIntegrationTest.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)