Derby is really an in-memory database

Up to Derby, the in-memory database mode wasn’t a real one because data was stored into files onto your disk. The new supports a real in-memory mode were data is only stored in memory, with no files being created. As stated in the new features page : Initial implementation of a storage engine for Derby where all data is kept in memory. There is no documentation for this feature. This functionality itself is not yet fully implemented, but users are welcome to experiment with it. So I did test it.

First of all, if you are using Maven, you will be disappointed to know that the release is not in the default Apache repository. You need to add the following repository to your pom.xml :

  <id>Apache Repo</id>
  <name>Apache repository for Derby</name>

Then, the JDBC URL has to be changed from jdbc:derby:chapter02DB;create=true to jdbc:derby:memory:chapter02DB;create=true.

As a little benchmark, I have an application with 25 test cases using in-memory storage with Derby It took 5 minutes and 53 seconds to run all the tests. With the new it only took 21 seconds. Not bad.

Categories: Java

Tagged as:

1 Comment »

  1. hsqldb in in-memory mode is pretty cool for development too. I use it even for my blog (persistence mode of course) running on fairly old low mem hardware. But derby has the out-of-the-box advantage since it is included in the JDK as JavaDB đŸ˜‰

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s