1- In Netbeans , this JDBC_URL works fine (using stand alone embedded Derby ):-
someApp (this is the directory)
|
src
|
dataBasePackage.myDB
mainPackage
|
MainClass.java
JDBC_URL= “jdbc:derby:src/dataBasePackage/myDB”;
2- A folder on local machine name : “appFolder” contains following : appFolder image
the .exe works fine and app starts...BUT user can’t connect to myDB ...which means JDBC_URL is wrong.
my question: When I want repackage the someApp to get a someApp.jar, I have to change the JDBC_URL to match the “appFolder” ; I tried multiple combinations,none worked !!
P.S: setting myDB on “file system” like JDBC_URL=” jdbc:derby:myDB “ ...also not work though with different arrangement .
You control the location of your database folder via your JDBC Connection URL, and via the specification of the Derby "system home".
Both these concepts are clearly explained in the Derby documentation. To read about that, start here: https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/devguide/cdevdvlp34964.html
The location can be specified in a relative or absolute fashion.
If you give an absolute database name in the Connection URL, the database is located at the name you specify. Since it is absolute, it doesn't depend on the Derby system home.
If you give a relative database name in the Connection URL, the database is located relative to Derby's system home: http://db.apache.org/derby/docs/10.11/ref/rrefproper32066.html