• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which embadded database is good for application

 
Swaroop Kunduru
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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.

Regards,

Swaroop Kunduru.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic