Hi Thanks for responding, I've added my comments in below. On Dec 9, 2009, at 11:30 AM, Kees Nuyt wrote:
> On Tue, 08 Dec 2009 22:07:34 +0100, John Clayton > <[email protected]> wrote: > >> Hi >> >> I've got two processes opening up two sqlite databases. Assuming the >> databases are called A and B respectively, then both processes do >> this: >> using A, BEGIN IMMEDIATE >> using B, BEGIN IMMEDIATE >> ... do some stuff possibly involving A&B ... >> using B, COMMIT >> using A, COMMIT >> >> In a couple of cases, I've seen one of the processes get an exception >> on COMMIT, the error is 'DB is locked'. I had thought that BEGIN >> IMMEDIATE resulted in a write lock being taken out on the DB, and >> therefore it should be possible to get a locking error on commit. >> >> Has anyone seen this kind of locking error or have >> suggestions as to how I could track it down? > > First a few questions: > > - Which version of SQLite? 3.6.11 > - On what platform? Mac OS X > - On what filesystem type is the database located? A local disk > - Are any PRAGMA's used? Nope > - Do you use the sqlite3 C API, the sqlite3 C & C++, the sqlite3xx API is what we mostly use > command line tool, or some wrapper? > - Did you access any other databases than A or B? > Yes. I should have mentioned that. One of these two processes locks the DB slightly differently. It does this: create a NEW DB, lets call it C attach to A attach to B BEGIN IMMEDIATE copy all table content from A into C COMMIT detach B detach A > You could try PRAGMA locking_mode=EXCLUSIVE or start your > transaction with BEGIN EXCLUSIVE. How is that different from BEGIN IMMEDIATE, I understood that to have the same affect. > >> Thanks > -- > ( Kees Nuyt > ) > c[_] > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

