I know this can be done, as I've head it alluded to many times: including an embedded read-only hsql db (via files) in a .jar file and accessing it.
This is how I have it set up:
My embedded db jar file contents:
This gets successfully exported into my web app as "db.jar" in WEB-INF/lib/
My question is what is the
JDBC url format to access this inside the generated jar file?
According to these sources:
http://hsqldb.org/doc/2.0/guide/running-chapt.html#running_inprocess-sect
http://hsqldb.org/doc/src/org/hsqldb/jdbc/jdbcConnection.html
http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getResourceAsStream(java.lang.String)
the URL should be:
But that doesn't work, or I wouldn't be posting here
I've tried every variation I could think of:
Plus replacing forward slashes with double backslashes (I'm on a windows 7 system at the moment), and every combination of slashes and dots I can think of. I haven't been able to find the specification for the "file_in_jar" notation mentioned in the HSQLDB documentation.
If I access the files that get compiled into the jar with a URL like this:
then it will work. Obviously this doesn't help me for deploying an application though.
I'm using hsqldb 2.0.0,
java 1.6.0, and
tomcat 6.
Thanks in advance for any help.