Thursday, January 24, 2008

Database in a File

For the past few years I have been using the SQLite database on a variety of software projects. The more I use it the more uses I find for it. Perhaps the best use I have found is in creating binary file formats with my applications. SQLite gives me the benefits of using a binary file format (speed, size, a bit of opaqueness) without the fuss of creating and (more importantly) maintaining custom code. And since SQLite works as an embedded database there is nothing to setup in advance. This is a huge benefit! Recently I have started using the Java connector for SQLite. I write a lot of code in Java, so I was happy to see SQLite get a first class connector. They even include a pure Java version, so you can take advantage of SQLite files without having to deal with platform specific issues. For improved speed you can opt for the native version. It uses the JNI interface to perform all the file IO in C. The trade-off is you have to build and install the native C library for your target system.

No comments: