One of the difficulties in iPhone is that it lacks Core Data, thus requiring developers to handle the database directly. While the system has SQLite built in (in libsqlite3.0.dylib ), the functions just beg to be wrapped up into something more usable.
Using it is easy enough. Just import the source files, import the libsqlite3.0.dylib framework, and then after that it is fairly straightforward.
Initializing the Database
First get the path to the database (make sure this is outside of your application bundle or it will get overwritten on every upgrade), then just call:
FMDatabase *database = [[FMDatabase alloc] initWithPath:path];
The database is now initialized and ready to use. We’ll cover more advanced usage of the database, along with DAO patterns, at a later date.