Re: [sqlite] END TRANSACTION failed with "database is locked"
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 >sqlite-users@sqlite.org > > 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: sqlite-users@sqlite.org > 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" <sqlite-users@sqlite.org> > 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 <sqlite-users@sqlite.org> > 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 Mara
Re: [sqlite] END TRANSACTION failed with "database is locked"
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 >sqlite-users@sqlite.org > > 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: sqlite-users@sqlite.org > 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" <sqlite-users@sqlite.org> > 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 <sqlite-users@sqlite.org> > 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 Mara
Re: [sqlite] END TRANSACTION failed with "database is locked"
> 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. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] END TRANSACTION failed with "database is locked"
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 sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users