I'd also make sure that all read-cursors are finished before starting a 
transaction. Or, take the exclusive lock already before the queries (possibly 
that is what was meant)

--- kennethinbox-sql...@yahoo.com wrote:

>From: Ken <kennethinbox-sql...@yahoo.com>
>To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
>Subject: Re: [sqlite] Multiple Writers and Database is Locked Problems
>Date: Sat, 18 Jul 2009 12:29:33 -0700 (PDT)
>
>
>I like to start each of my transactions with a "Begin Immediate" 
>that way the database file is locked at that point. And its
>relatively simple to test for the DB locked at that stage and 
>handle waiting or returning an error.
>
>HTH
>
>--- On Fri, 7/17/09, Cole <c...@opteqint.net> wrote:
>
>> From: Cole <c...@opteqint.net>
>> Subject: [sqlite] Multiple Writers and Database is Locked Problems
>> To: sqlite-users@sqlite.org
>> Date: Friday, July 17, 2009, 6:38 AM
>> Hi.
>> 
>> Im hoping someone might be able to help me with the
>> problems im having, or
>> suggest a better method of doing what im trying to achieve.
>> Currently im
>> using sqlite3 3.6.10. I don't mind updating or downgrading
>> it if needed.
>> 
>> I have a program that I run multiple instances of. When
>> they start, they
>> parse the config file, and open a connection to each
>> database that is
>> listed. Each database only has a single table in it. They
>> then receive
>> requests, do a select on the database, parse the returned
>> data, modify the
>> data, then update the data to the database. However, I am
>> running into the
>> "database is locked" error when trying to update the
>> database. I fully
>> understand that 2 or more instances might be trying to
>> update the same
>> table, but is this the only reason this might happen now?
>> Or are there also
>> other scenarios where this might happen?
>> 
>> Ive searched the mailing list and I see that you mention
>> using random seed
>> and time to handle the SQLITE_BUSY return value, and then
>> trying to perform
>> the update again. I was perhaps wondering if there are any
>> other suggestions
>> for dealing with this scenario where there might be
>> multiple writers to the
>> same database at the same time?
>> 
>> Regards
>> /Cole
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to