int nRet = sqlite3_open(szFile, &mpDB);
if (nRet != SQLITE_OK)
{
}
setBusyTimeout(mnBusyTimeoutMs);
sqlite3_exec(mpDB, "Begin Transaction;", 0, 0, &szError);
sqlite3_exec(mpDB, "UPDATE query", 0, 0, &szError);//some update table query
sqlite3_exec(mpDB, "Commit Transaction;", 0, 0, &szError);///Here it gives error database is locked
Above code works fine for insert command instead of update command.
See Question&Answers more detail:os