I remember this coming up before a while ago (but I can't seem to find it).

I think you have to get the path of the jar file and then open it in h2 as you would a zip file, giving it the full path (or relative to the current working directory).

So you have to use some classloader magic to get the jar file.

http://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file

Then feed that into the h2 connection string

But there might be a better way :).



On 30/05/2012 11:51 PM, bee vo wrote:
Yes, I am trying to make a connection to a DB inside the same jar the
java classes which make the connection will be in.

On May 30, 10:04 am, Ryan How<[email protected]>  wrote:
A jar is a zip file :)

Do you mean access it via classpath rather than naming the zip/jar file?

On 30/05/2012 10:44 PM, bee vo wrote:







Hey, is there a way to make a connection to a db file that is inside a
jar? I know that H2 has a feature that allows connection to a db
inside of zip file but how would I get a connection to a db file
inside a jar?


--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to