Use sqlite database in iphone using xcode 4.3.2
<p>How to use sqlite database in iphone using xcode 4.3.2....
I am having problem in finding path of my database ?? since i had copied FormDB.sqlite in Database folder in my app....Please help me as i am new to iphone programming...</p>

<p>calling this method in applicationDidFinishLaunching of Appdelegate file but it is returning success=false</p>

<pre><code>- (void) copyDatabaseIfNeeded {

    //Using NSFileManager we can perform many file system operations.
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;
    NSString *dbPath = [self getDBPath];
    BOOL success = [fileManager fileExistsAtPath:dbPath]; 

    if(!success) {

        NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"FormDB.sqlite"];
        success = [fileManager copyItemAtPath:defaultDBPath toPath:dbPath error:&amp;error];

        if (!success) 
            NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
    }   
}

- (NSString *) getDBPath {

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
    NSString *documentsDir = [paths objectAtIndex:0];
    return [documentsDir stringByAppendingPathComponent:@"FormDB.sqlite"];
}
</code></pre>
