Hi, Thanks for your replies.

Actually I have only one thread writing to the table and there can be 'n'
number of threads reading the table. I am not yet found why this "database
locked" error came in my application.

Since the database is locked even "End TRANSACTION" also won't help, right?

I will comeback with more details 2row as today is holiday here.

Regards,
Manoj Marathayil


On Wed, Oct 8, 2008 at 9:30 PM, <[EMAIL PROTECTED]> wrote:

> Send sqlite-users mailing list submissions to
>        [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> or, via email, send a message with subject or body 'help' to
>        [EMAIL PROTECTED]
>
> You can reach the person managing the list at
>        [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of sqlite-users digest..."
>
>
> Today's Topics:
>
>   1. END TRANSACTION failed with "database is locked"
>      (Manoj Marathayil)
>   2. Re: END TRANSACTION failed with "database is locked"
>      (Alexandre Courbot)
>   3. Re: END TRANSACTION failed with "database is locked" (Ken)
>   4. Re: Record locking (Ken)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 8 Oct 2008 19:20:02 +0530
> From: "Manoj Marathayil" <[EMAIL PROTECTED]>
> Subject: [sqlite] END TRANSACTION failed with "database is locked"
> To: [email protected]
> Message-ID:
>        <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
> I am executing some operations in a loop and all the operations are wrapped
> inside a transaction. During one iteration the "END TRANSACTION" returned
> with an error "database is locked". Since this is in a loop my next request
> to "BEGIN TRASACTION" failed with "cannot start a transaction within a
> transaction". What is the normal way to get rid of this situation? Is it
> right to check the status with "sqlite3_get_autocommit" and issue a
> "ROLLBACK TRASACTION" if it inside a transaction before issuing BEGIN?
>
> Regards,
> Manoj
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 8 Oct 2008 22:58:59 +0900
> From: "Alexandre Courbot" <[EMAIL PROTECTED]>
> Subject: Re: [sqlite] END TRANSACTION failed with "database is locked"
> To: "General Discussion of SQLite Database" <[email protected]>
> Message-ID:
>        <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1
>
> > I am executing some operations in a loop and all the operations are
> wrapped
> > inside a transaction. During one iteration the "END TRANSACTION" returned
> > with an error "database is locked". Since this is in a loop my next
> request
> > to "BEGIN TRASACTION" failed with "cannot start a transaction within a
> > transaction". What is the normal way to get rid of this situation? Is it
> > right to check the status with "sqlite3_get_autocommit" and issue a
> > "ROLLBACK TRASACTION" if it inside a transaction before issuing BEGIN?
>
> This is probably because you still have one active query when during
> the commit. Try to sqlite3_finalize all your queries before the
> commit.
>
> Alex.
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 8 Oct 2008 08:46:39 -0700 (PDT)
> From: Ken <[EMAIL PROTECTED]>
> Subject: Re: [sqlite] END TRANSACTION failed with "database is locked"
> To: General Discussion of SQLite Database <[email protected]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=iso-8859-1
>
> The second error problem is due to the first.
> ?Another process has begun a transaction Prior to you running the commit.
> /End transaction. At this point you have no choice but to rollback and re
> run the loop.
>
> A Proper fix might include changing the begin transaction to a "begin
> immediate",? Then Either The begin will either fail and not be able to start
> a TXN. Or it will succeed.. If it fails simply wait a while and retry.
>
> I would not follow the other posters advice regarding finalize. You want to
> use sqlite3_reset on all of the prepared statements. Before you close the
> database you should finalize or if your unlikely to need the statement in a
> while then finalize.
>
> HTH
> Ken
>
>
> --- On Wed, 10/8/08, Manoj Marathayil <[EMAIL PROTECTED]> wrote:
> From: Manoj Marathayil <[EMAIL PROTECTED]>
> Subject: [sqlite] END TRANSACTION failed with "database is locked"
> To: [email protected]
> Date: Wednesday, October 8, 2008, 8:50 AM
>
> Hi,
> I am executing some operations in a loop and all the operations are wrapped
> inside a transaction. During one iteration the "END TRANSACTION"
> returned
> with an error "database is locked". Since this is in a loop my next
> request
> to "BEGIN TRASACTION" failed with "cannot start a transaction
> within a
> transaction". What is the normal way to get rid of this situation? Is it
> right to check the status with "sqlite3_get_autocommit" and issue a
> "ROLLBACK TRASACTION" if it inside a transaction before issuing
> BEGIN?
>
> Regards,
> Manoj
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 8 Oct 2008 08:51:35 -0700 (PDT)
> From: Ken <[EMAIL PROTECTED]>
> Subject: Re: [sqlite] Record locking
> To: General Discussion of SQLite Database <[email protected]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=iso-8859-1
>
> I don't think sqlite is meant to be used that way. The locking is at the
> database level or in the case of "shared_cache" mode the locks are held at
> the table level. So locking is pretty much nothing or everything approach.
> If you look at the journal design you'll see it applies to the entire file.
>
> Locking at the row level would be unpractical without a major overhaul.
>
> I am not the author, nor a developer. The authors do suggest that if you
> need row locking or other "heavy weight" DBMS features that there are other
> DB's availble.
>
>
> --- On Tue, 10/7/08, Steven Charest <[EMAIL PROTECTED]> wrote:
> From: Steven Charest <[EMAIL PROTECTED]>
> Subject: [sqlite] Record locking
> To: [email protected]
> Date: Tuesday, October 7, 2008, 7:22 PM
>
> Are?there any plans to put?record locking in Sqlite?
> _______________________________________________
> 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
>
>
> End of sqlite-users Digest, Vol 10, Issue 13
> ********************************************
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to