db4o object database

I’ve looked for a small embedded, easy to use data store for implementing my small software-engineering course project. Of course I’ve looked at MS SQL Server, which works great together with LINQ and the .NET world. However it isn’t small and lightweight. I’ve also tried Hibernate.NET, however the .NET version is way behind the Java-Version feature wise. The attribute/annotation-based mapping is buggy, the LINQ-Implementation unusable etc. Other frameworks failed to impress me as well.

So accidently I’ve found the object-database db4o, which fits my requirement perfectly. It is really small, less than 800 KiB. It it easy, you just store your native objects, done. Retrieving the objects is also easy, because db4o support LINQ.

Yeah, a object-database is a new territory for me and its exiting to gain experience with it. So here are my first few impressions:

Positive:

  • As I said, its easy, simple etc. No XML-Files, no mappings, no ‘alien’-SQL in your C#-Code, no ‘Hibernate-Session’ managing head aches etc.
  • Easy extension of the db-schema, because your classes are your schema.
  • No ‘magic’ like compile-time/runtime-instrumented classes, no generated code.
  • Flexible, building-blocks API. You can run it in server-client-mode, embedded-mode, memory-database-mode, change persistence behaviors of classes, create backups, add versioning, add callbacks,  add different IO-Adapter etc.
  • Additional functionality like sending messages to the server.

Negative:

  • High coupling between the database and your domain-classes, because your classes are the database-schema.
  • Activation / Update-Depth: Because you store and retrieving object-graph, db4o stops a some point to load it automatically (otherwise you would load the whole db). You can manage this manually or use instrumented code. But with instrumented code you get some ‘Hibernate’-like problems back.
  • The tool-support is really, really bad.
  • No standard like ‘SQL’ is supported, so you cannot access your database with a query-tool.
  • Not entirely maintenance free, due defragmentation.

Neutral

  • The object-database isn’t a rational database. So if you start to use joins etc you will get pure performance. Instead the object-database is really god at traversing the object-graph. This requires some rethinking.
Tagged on: , ,

One thought on “db4o object database