----- Original Message ----- From: "Jay Sprenkle" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Tuesday, August 22, 2006 6:06 PM
Subject: Re: [sqlite] Re: database locked


On 8/22/06, Christian Smith <[EMAIL PROTECTED]> wrote:
Laura Longo uttered:

>
>
>> On 8/21/06, Laura Longo <[EMAIL PROTECTED]> wrote:
>>> I've tried also executing the query "begine exclusive" before the
>>> "update",
>>> and "commit" to end the entire routine, and the query that now >>> returns the >>> exit code 5 (database locked) is "begin exclusive", I don't know if >>> this
>>> can be meaningful...
>>
>> It sounds like some other application has locked the database file.
>> Do you have a virus scanner? This can sometimes cause problems.
>> It will lock the file you use for the database.
>
> My applications are running under Linux (CentOS, kernel 2.6.16) and I > have no
> virus scanner.


Try using sqlite3_busy_timeout(), to get round the temporary locks if
possible. SQLite will retry locked database access until the command
either succeeds or times out.

She already has a nice variable delay retry in her code.
As long as she seeds the random number generator with a different
seed for each process It should eliminate problems with synchronized
retry collisions.



In the source code at the begin of the two processes that execute queries on the database I've used the code:

srand(time(NULL));

to avoid collisions...

(I never started the two processes at the same instant)


http://www.sqlite.org/capi3ref.html#sqlite3_busy_timeout

If this does not fix your problem, it is possible that an application has
a read lock permanently open. Check that your readers are not doing a
begin without a commit.

That was my thought too. It sounds like something else has the file
locked.

Laura is there a backup program that might be reading your database
and locking it?

Only my two processes execute queries on the database and no other program... Is there any other way to be sure of this? Can you suggest me a test to do when the lock will happen again to have more info?

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

Reply via email to