Zwiebel
Zwiebel

Reputation: 1615

How to access database from derby in the same directory as jar?

I have developed a movie organizer program in Java with derby database. It works fine on my computer, however I couldn't figure out how to make it "portable" (only for my own use).

My problem is, that if I use the

String url = "jdbc:derby://localhost/Movie";

code for the connection to the derby database, it is only working on my computer as it is the path specified directly to my Netbeans database location. I would like to put the Movie folder near the .jar file of the application and make it portable so I can use the same database everywhere.

Any help would be appreciated on how could I achieve this.

Upvotes: 0

Views: 428

Answers (1)

Stefan
Stefan

Reputation: 12453

You can access the database from the filesystem for example like this:

jdbc:derby:./myDatabaseName

Upvotes: 1

Related Questions