If using the sqlite3 database which your program has access to on the phone for local database storage.
#import <sqlite3.h>
And create an openDatabase() method. Also add a variable for keeping the db around.
sqlite3 *db = nil;
Just make sure you call your open database method before using the database. Check this page out http://ved-dimensions.blogspot.com/2009/03/iphone-development-sqlite3-populating.html
Might give you something that you can use.
+(sqlite3 *) getNewDBConnection{
sqlite3 *newDBconnection;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"data.sqlite"];
// Open the database. The database was prepared outside the application.
if (sqlite3_open([path UTF8String], &newDBconnection) == SQLITE_OK) {
NSLog(@"Database Successfully Opened :)");
} else {
NSLog(@"Error in opening database :(");
}
return newDBConnection;
}