[ 
https://issues.apache.org/jira/browse/DERBY-4931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12968991#action_12968991
 ] 

Knut Anders Hatlen commented on DERBY-4931:
-------------------------------------------

I'm glad that it worked for you. I see that the developer's guide says that the 
classpath subprotocol shouldn't be necessary ( 
http://db.apache.org/derby/docs/dev/devguide/cdevdvlp91854.html ), but I 
haven't been able to boot a database from the classpath without using a 
subprotocol myself. Does anyone know if (and how) that's supposed to work? If 
not, maybe we need to update the docs.

As to the question about createFrom, I believe the answer is that there are no 
plans for supporting it at the moment (maybe just because no one has thought 
about it before). But feel free to file a JIRA issue for that improvement if 
you think it's a useful feature.

> 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: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)

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

Reply via email to