6

I am a beginner in programming Java Desktop Application interacting with databases. My goal is to make a simple java application which uses a database to store it's data locally. After some googling I found that SQLite/Derby would cover my needs.

I've googled SQLite and Derby and I found that in order to use them I need to install them on the computer through commands in terminal.

My question is how the application could be done so that at the end the client will be given a simple installer file which installs both Java Application and the SQLite/Derby Database avoiding doing any installations before.

Is that possible?

alicjasalamon
  • 4,171
  • 15
  • 41
  • 65
panda
  • 315
  • 4
  • 15

2 Answers2

5

I think the easyest for you is to use the database in embedded mode. Different databases could be use in this way :

The database is packaged with your application jar, so you don't need to install it.

Community
  • 1
  • 1
gontard
  • 28,720
  • 11
  • 94
  • 117
  • Well i'm a newbie in SQLite and i'm trying to understand it's philosophy. SQLite creates and uses just one file. Does this database require anything else than java enviroment?If i use SQLite DB that has already records in it could i extract the file as it is and the application will work? – panda Aug 28 '12 at 14:13
  • @Panayiotis the line `DriverManager.getConnection("jdbc:sqlite:test.db");` specify which file (existing or not) to use. Look [here](http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite/Connecting) for other details – gontard Aug 28 '12 at 14:28
0

You could write a script (e.g. bash script on UNIX) which checks if the DB is installed, installs it if needed and runs the .jar file of your program. On windows you can achieve the same with a batch script. So the user would only have to execute the script.

gmazlami
  • 684
  • 2
  • 9
  • 18
  • That's a possible solution but I want to avoid scripts and create a single file installer wizard. Thanks anyway! – panda Aug 28 '12 at 14:15