title: 'database is locked' in sqlite in iPhone
body: <p>Hello friends I have searched a lot about this error. I found some advice like you must use sqlite_finalize() statement and I use it. Have a look on my code.</p>
  
  <blockquote>
    <p>-(void) updatePostingsForLike:(NSString *)postingKey isLiked:(NSString *)isLiked{</p>
  
  <pre><code>  [self initWithDB]; 
    sqlite3_stmt *stmt;
  
    if(sqlite3_open([[self dbPath] UTF8String],&amp;(db)) == SQLITE_OK) {
  
        NSString *str=[@"" stringByAppendingFormat:@"update posting set isLiked='%@' where postKey='%@'",isLiked,postingKey];
        const char *sql=[str cStringUsingEncoding:NSUTF8StringEncoding];
        int status;
        status= sqlite3_prepare_v2(db,sql, -1, &amp;stmt, NULL);
  
        if(SQLITE_DONE != sqlite3_step(stmt))
        {
            NSLog(@"%s",sqlite3_errmsg(db));
  
        }
  
        sqlite3_finalize(stmt);
  
        [self closeConnection];
  
    }}
  </code></pre>
  </blockquote>
  
  <p>I followed all the rules. I can update my record only once. First time only. It throws error on second time. What should be the solution ? I stuck in such problem since last 2 days !</p>