Derby Is Cool
By Adrian Sutton
I thought it was worth mentioning that I got to play with Derby as part of the Time Tracker mini-project I mentioned earlier. Very cool. I’ve not had a need to work with an embedded database before so it was really nice to have a small, efficient library that handled all my data storage needs. The only complaint I’d have is that it needs to use a directory to store stuff in (it’s a little more flexible than that but a directory is always created and used). It would be really nice to be able to just point it at a file and say "that’s my database, do your thing".
It probably would have also been useful to have a persistence tool that worked well with the embedded database. For instance, I was really storing a database representation of TimeEntry objects. It would have been nice to be able to have an API similar to:
store(TimeEntry entry);
find(TimeEntry entry);
update(TimeEntry entry)
The find method would have some magical way of detecting which data items within the TimeEntry I’d actually specified and form a search query for all entries that had those attributes with those values (but ignore attributes that I hadn’t explicitly specified). Similarly the update method would have some magical way of knowing which entry I was talking about.
Of course, I wrote an interface along those lines but it would have been nice to avoid relearning SQL to do so. An embedded database is going to be used in situations like this a lot where what’s really required is an embedded persistence mechanism. I’m sure it’s possible to achieve this but it would be nice if there were a project dedicated to it that worked out-of-the-box so to speak.