Java databases get small
db4o, PointBase offer relational, object-oriented options for getting data to PDAs
PDAs sound like the ideal home for database applications. You’d like to carry gobs of information around in your purse or pocket, ready to whip out and reference at a moment’s notice, right?
That could be an ideal use of Java’s “run everywhere” capability, and the two database products I tested seek to make both those ideals into a reality.
Although these products may have the same goal, they take different paths to get there. PointBase is a relational database, although it allows augmenting SQL queries using Java methods. db4o creates pure object-oriented databases, but implements a novel query technique.
The relational vs. object-oriented database decision often comes down to complexity: How explicitly do you want to structure your data? Object-oriented databases link your data together for simple retrieval; relational databases use multiple searches. As is so often the case, the database technology you choose will depend on the nature of the data your application must manipulate, the degree of interoperability you must support, and your developers’ skill level.
PointBase Micro 5.0
PointBase is a 100% Pure Java relational database system available in two flavors, Embedded and Micro. Micro is architected for J2ME apps, but Micro version applications can run in a J2SE environment as well.
I explored PointBase Micro Version 5.0 running on my reliable Palm PDA, running Palm OS 3.5. PointBase Micro’s footprint is an amazingly small 90KB for J2ME CDC and PersonalJava environments, and an even more amazing 45KB for J2ME MIDP (Mobile Information Device Profile) environments. Necessarily, the MIDP version has fewer capabilities than the CDC version.
Configuring a PointBase environment for a specific target environment and application is a matter of selecting the proper library (.JAR) file. You can choose from a number of libraries, each of which is crafted with a particular combination of features for a specific platform. Version 5.0 also adds support for the J2ME CDC DataSource interface, making it easier to create a connection to the database.
Putting a relational database engine in such a small space requires some judicious corner cutting. PointBase uses a JDBC subset API, as well as a subset of SQL92 as the query language. The JDBC subset, called the Lite API, implements the Metadata API calls only in part and supports only one transaction isolation level. The SQL92 subset provides a restricted set of data types, no triggers, and no views, among other omissions.
Still, PointBase delivers capabilities you wouldn’t expect with such limited elbowroom. You can encrypt a database as well as control access with username and password restrictions. The SQL syntax is a healthy subset of the essentials, allowing you to quickly access and create, insert, and delete indexes, tables, and more.
Creating and transferring a PointBase application was as easy as it gets, after I had downloaded Sun’s MIDP toolkit with the additional Palm libraries. One clever tool provided with PointBase Micro is MicroConsole, a midlet that allows you to examine tables within a database on an MIDP device.
With MicroConsole, you can explore tables in the database, navigate through table definitions, and even examine table contents. It comes in handy if you’re debugging a new J2ME database app and want to make sure your database is properly constructed.