db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor Moran (JIRA)" <j...@apache.org>
Subject [jira] Created: (DERBY-4931) Loading db from classpath or jars appears not to work
Date Mon, 06 Dec 2010 18:11:11 GMT
Loading db from classpath or jars appears not to work
-----------------------------------------------------

                 Key: DERBY-4931
                 URL: https://issues.apache.org/jira/browse/DERBY-4931
             Project: Derby
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 10.6.2.1
         Environment: Windows 7
            Reporter: Conor Moran


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:mtDb");
    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 veridied the zip was on cp
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)




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message