Object stores came about when programmers wanted to be able to access objects just like they would out of a cache. They wanted to be able to persist a data entity right to disk without thinking about how it was stored, how it should be translated to SQL, and how to break it apart into separate tables. SQL-based RDBMSes were the norm but C++ was growing in popularity. Older languages like C and COBOL were made for SQL, but SQL was not made for objects. So object databases were born, allowing simple operations like get and set, instead of lengthy mapping code. There were many commercial offerings of this type of system in the 90s, like Objectivity and Versant.
Fast forward a decade or so, and these still remain niche players. The idea is still captivating. Many programmers use what is known as an ORM tool that maps an object to SQL. These include Hibernate for Java and ActiveRecord for Ruby. The downside is that these tools often ignore the power of SQL while degrading performance. They generally involve code-generation, which is often messy.
Db4o is an object database that is open-source and free to download. It began with Java, but also has a .NET port. It is supported by Versant, and is released under GPL and commercial license.
Being a SQL aficionado, I wanted to give db4o a try. This is either a server or a library that allows you to specify a file to write to, then you are on your way to simple persistence. After downloading the software and adding the jar to my NetBeans project, all I had to do was write a couple of lines to test it out. You really don’t have to write a special DAL for basic CRUD, only for when you have special queries that you want to write. I created an application that was a basic CRM tool that tracked customers, service representatives, and the contact between the two, including dates, times, and notes. The DAL for this took less than 25-lines. Pretty neat. I didn’t find any errors and as everything worked like a charm. It is also ACID-complaint, does transactions and hot backups.
Java and .NET have a lot of the market, so db4o is a pretty cool product. I now need to hook it up to my benchmarking suite to check out its performance. OODBMSes have their place, but I still like SQL more.