There can be only one thread that has an exclusive write lock on the database. Most likely this is a bug in your application.
Heres what I do for my multi threaded app: 1. All transactions use "begin immediate" (that way I don't do a bunch of work only to find the db locked later). 2. The begin immediate is wrapped in a while loop, do { begin immediate } while (sqlite busy || sqlite locked). 3. Commit the transaction. 4. Select statements else where can also get sqlite_busy. This happens due to the exclusive lock above! Its just the way sqlite works. So, select statements the first step command can get a sqlite busy. S prepare refetch: step if sqlite busy sleep a while goto refetch do { work step } while (sqlite_row) HTH Xuanvinh Vu <[EMAIL PROTECTED]> wrote: I didnt realize that it could cause livelocks. Thank you for bringing that to my attention. It still doesnt explain why the database stays locked. I could just ignore the error and wait to update the database the next time the thread runs again. What I want to know is why once I got the exception that the database is locked it stays locked and I cant update the databases with other threads. _________________________________________________________________ Watch Cause Effect, a show about real people making a real difference. Learn more. http://im.live.com/Messenger/IM/MTV/?source=text_watchcause _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users