The PalmOS includes a filesystem that functions as a database, albeit a non-relational one. "Tables" are accessed on an individual basis and any joins that must take place must be "hand-rolled" by the developer. (This is not the case if you're using a commercial database for the PalmOS such as Oracle Lite or IBM's DB/2 Everywhere, but that's a discussion for another article!) AppForge includes a utility that converts Microsoft Access .MDB databases into the .PDB format used by the PalmOS. This process is as simple as creating a database using Microsoft Access and then converting the database using the AppForge Database Converter for Palm (see Figure 1).
The AppForge Database Converter for Palm.
Our customer database is quite simple, containing fields for a name, company, email address, address, city, state, ZIP, and sales representative. Before converting the file, you'll be prompted for a CreatorID and a Type. These are PalmOS constructs used to uniquely identify a specific database (necessary since all databases are stored in one flat-file system). To reserve a unique ID (important if you're doing commercial PalmOS development), visit http://www.palmos.com/dev/tech/palmos/creatorid/. I completed this process and reserved the CreatorID XZXZ, which you'll see if you analyze the source code included with this example (see Figure 2).
Setting a database CreatorID and Type.
Once the conversion process has been completed, the converter will ask whether you want to create a Visual Basic code module for working with the database. Choosing OK causes a complete helper module to be created, simplifying routine tasks such as opening the database and getting/retrieving records. This module also contains a new Visual Basic type that represents a single record within this table.