Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where data is stored in apache derby?

 
Punit Jain
Ranch Hand
Posts: 1016
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m creating a standalone application using swing and apache derby, and i created a jar file, which has my application and derby jars.
and i gave that jar to someone who is using that application.
what the application is doing:-
it just taking the the values from form and inserting them into database.

and i just want to know where this data is actually stored...
in that jar file which i gave???

if yes, then if someone loose that jar file the entire data is lost...??
how do i backup that data???
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not in jar.
I assume that you are using derby embedded driver.
Database files are created somewhere on the disk.
A full path to the database directory could be explicitly given in the connection string - in that case derby uses that path.
In case if only a database name is given in the connection string (without the full path), Derby searches the database in the "system directory".
The system directory could be declared using derby.system.home property.
If this property is not declared, then derby uses the current directory (current = directory in which the application - jar- was installed).
http://db.apache.org/derby/docs/10.8/devguide/
 
Punit Jain
Ranch Hand
Posts: 1016
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay...thanks...
but if i m using only jar not installer or exe (to install that software), that time where the data is stored, do it stores the data where i copy that jar file into my system???
 
Tim Moores
Bartender
Posts: 3135
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You seem to assume that the way Derby is installed somehow influences how/where its data files are stored - it doesn't.
 
Punit Jain
Ranch Hand
Posts: 1016
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You seem to assume that the way Derby is installed somehow influences how/where its data files are stored - it doesn't.


then where it is...

System Directory..?

To be short and precise..

where can i see my created databases in derby, in my system???
i have added derby to my eclipse plugins, and then i created one database, where can i see that database file??
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Punit Jain wrote:
To be short and precise..

where can i see my created databases in derby, in my system???
i have added derby to my eclipse plugins, and then i created one database, where can i see that database file??


Somewhere in the eclipse directory or - could be - in the project directory - if eclipse is using embedded driver.
Or somewhere in the database installation directory - if eclipse is using standalone installation server.
Say your data base is named "mydatabase", then fire "find / -name mydatabase -print" command if you are using linux,
or on Windwos right click on the root folder and choose "search files/folders" tool to find "mydatabase" directory .... and you will see ;)

At the beginning please read carefully documentation, especially this:
http://db.apache.org/derby/docs/10.8/devguide/cdevdeploy32171.html

then choose how do you want to deploy your application (using the embedded driver or the standalone server - embedded is a better option in my opinion),
and how do you want to create the database on the client computer.
For example, you can create an installation script that will create the database (tables, procedures etc) on the client machine.
Another option might be to include code for database creation inside your application - the application checks if the database exists,
if no - creates it.

 
Punit Jain
Ranch Hand
Posts: 1016
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Ireneusz Kordal ...
one more thing i want to know, i have not read the link you given yet, but as you said

you can create an installation script that will create the database (tables, procedures etc) on the client machine.
Another option might be to include code for database creation inside your application - the application checks if the database exists,
if no - creates it.


these i want to know, how to do these both??
are they given in that link??

can you please tell me how to do this??

you can create an installation script that will create the database (tables, procedures etc) on the client machine.
 
Gabriel O'braiden
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're running your jar from linux the home directory is used as the default location for any database files instead of the directory of the jar file being run.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic