db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Morton <djmorto...@yahoo.com>
Subject Storing/Accessing a Derby database inside a JAR
Date Sun, 02 Apr 2006 17:59:26 GMT
Hello all:

I have created a derby database called NameDB which
contains a table which contains a list of 10000 names.
 I also have a class called djm.NameGenerator which
when constructed, connects to the database.  Methods
in the class then get names from the database.  It
works fine seperately, but I wish to put the database,
and the class (and eventually the derby.jar if
possible) into a jar file that is easily distributable
so the whole thing is self contained.

I created a jar using:

jar cf NameGenerator.jar djm NameDB

so that the database, and the NameGenerator class in
the djm package is put in to the jar.  However, if I
run a test.java program to create a NameGenerator
object, it errors when trying to connect to the
database:  SQLException: Database '/NameDB' not found.

My connection string (per the Derby Documentation) is:
I've tried multiple varitions on this (ie. NameDB,
/NameDB, /NameDB/ etc.)

And in the above, the NameGenerator.jar is in the

I've also tried specicifying the explicit path (ala
the Derby Manual):

Which results in the SQLException: Failed to start
Java Exception: The system cannot find the file
specified: java.util.zip.ZipException.

I'm really at a loss here.  Can anyone tell me what
I'm doing wrong?  I've read through all the relevant
sections of the Derby documentation, and I'm not
really sure what to do next.  Also, once I get this
sorted out, is there a way to include derby.jar inside
NameGenerator.jar so that just the one file could be

Any help that anyone can offer would be greatly

Daniel Morton

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

View raw message