varunkumar wrote:
i am using sqlite3 database in our project
in my project one daemon process running , in this daemon process i am opening the data base and inserts the data
 in to sqlite3    database  using  sqlite3_exec()  API . for every one
minute i am opening the database and  inserts the values in to database
using sqlite3_exec() API and closing the database. queryies are doing to database from another
processes using  sqlite3_exec()  API  . when query to database   from
another processes i am getting error   "sqlite3_exec function error:database
is locked "     in above daemon process  when this daemon process insert
values in to database for that minute. from nextminute onwards this daemon
process  insert values in to database except when i query the database from
another process.

Don't use sqlite3_exec. Use sqlite3_step and test the returned status. When you get an SQLITE BUSY you need to clear the contention. Try a short wait and relaunching the SQL statement with sqlite3_step.

If you are performing repeated SQl statements, use sqlite_prepare_v2 to initially compile the statement then use sqlite3_reset after each sqlite3_step. Use sqlite3_finalize before you close the DB connection.

If you are executing a burst of SQL statements, form a transaction with an initial BEGIN and a COMMIT at the end. It will run faster and be more robust.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to