• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Which embadded database is good for application

Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wanted a database which states when an application is started. Which database is good for it?

For Example:

If I have an address book java application which take in data and store in database. I happen to shut down the system several times in a day. I wanted the DB system should start when a command is given from java application. When a contact is added the DB should start and take in the data.

Please help.


Swaroop Kunduru.
Posts: 1210
Android Python PHP C++ Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are couple of solutions possible:
- SQLite, as Sean mentioned
- HSQLDB , previously known as Hypersonic
- Apache Derby, which is also packaged with JDK6 and above as JavaDB

Which one to use? Briefly, in my experience,
- SQLite has no JDBC driver developed by its own developers. Instead, JDBC drivers are available by third parties, like zentus and javasqlite. Each of these has its limitations - Zentus can't be used with SQLite 2.x DBs, while javasqlite is JNI based (so type 2 driver) and requires SQLite DLL for deployment. SQLite is a great DB (Google Chrome uses it!), but it requires such external libraries when using with Java. Also, SQLite is not supported by Hibernate out of the box.

- HSQLDB is easy to use. The only hassle I've faced is its implementation of committing. In addition to the regular COMMIT query, remember to also send a "SHUTDOWN" SQL command at the end of the app or whenever a connection is closed, to ensure all changes are *really* committed to file and visible to other connections. This is not a problem if using a single connection.

- Apache Derby/JavaDB is also easy to use and is the one I haven't faced any hassle with. An advantage is that it comes with the JDK6 installation (remember to install it), but it can also be downloaded standalone from Apache or Oracle sites.

These embedded DBs can't be accessed safely from multiple processes. So if your situation involves launching multiple instances of your app, none of these are suitable in embedded mode; they should be run in client-server mode.
Both HSQLDB and Apache Derby are supported by Hibernate and can also be executed in client-server configuration out of the box, while sqlite relies on some 3rd party solutions for client-server.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic