Well,
  I just have one thread writing and the others reading, is still it
not possible?

Leandro.


2007/11/29, Simon Cross <[EMAIL PROTECTED]>:
> On 2007/11/29, Leandro Sales <[EMAIL PROTECTED]> wrote:
> >   I had a single thread application that access one sqlite database
> > via SQLObject. Recently I change it and now I need to have multiples
> > threads accessing this database. I'm experimenting my new approach and
> > in some cases I get an exception from SQLObject, like this:
> > "OperationalError: database is locked"
> >   Is there any way to have multiple threads accessing SQLite database?
> > for instance, just one thread write to the database and the others
> > have just read-only access. If it is possible, this solve my problem.
>
> I've encountered this problem with SQLite while not using SQLObject.
> As far as I can tell, the short answer to your question is no.
>
> The long answer is that SQLite claims to be thread-safe [1] but as far
> as I can tell their definition of thread-safe is "will not corrupt
> your database" and not "operations will always suceed". Reading from
> the database in multiple threads should work if you are careful and
> your version of SQLite is recent enough, but if you read the answer to
> question 5 from the FAQ [2], it appears that writing to the database
> from multiple threads or proccesses will not succeed.  I believe it is
> attempting multiple simultaneous write operations which raised the
> "database is locked" error.
>
> Given that you have a single application I would guess it would be
> possible to manually acquire a Python threading lock and wait for the
> database to free up if you are sufficiently careful.
>
> [1] http://www.sqlite.org/faq.html#q6
> [2] http://www.sqlite.org/faq.html#q5
>
> Schiavo
> Simon
>


-- 
Leandro Melo de Sales.
Pervasive and Embedded Computing Laboratory
BRisa and E-Phone Projects Manager
Network Admin @ http://embedded.ufcg.edu.br/indexen.html
+55 83 3310-1404 (extension 208)

O especialista é alguém que conhece sempre mais sobre cada vez menos e
termina por saber tudo sobre nada!

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to