If you check back a few months, you'll see that I experimented with
mysql and several threads per one connection and didn't go too well..
It's just so much less error prone to have separate connections or a
producer/consumer pattern than debug a deadlock, race conditions or
phantom 'server gone away' situations.

On Oct 9, 5:33 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> The problem is that SQLite is not a client-server database and only
> thread can access a SQLite database at one time. If one thread access
> the db file, the file is locked and nobody else can use it until
> released.
>
> You should be using postgresql or mysql to do what you are doing.
>
> Massimo
>
> On Oct 9, 9:10 am, Scott Hunter <[EMAIL PROTECTED]> wrote:
>
> > When I tried that, I got the following error when attempting a query:
>
> >    ProgrammingError: SQLite objects created in a thread can only be
> > used in that same thread.
>
> > But when I try to create an SQLDB object in my thread, I get:
>
> >    OperationalError: unable to open database file
>
> > Maybe my thread didn't "instantiate its own connection to the
> > database"; what does this involve?
>
> > Thanks,
> > Scott
>
> > On Oct 8, 5:58 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > It depends on who starts the thread. The main problem is that the web
> > > server monitors threads and kills them when they take long.
> > > I principle a model, view controller can start its own thread but you
> > > should pass a SQLDB object to it. It needs to instantiate its own
> > > connection to the database and commit or rollback explicitly.
>
> > > Massimo
>
> > > On Oct 8, 4:42 pm, Scott Hunter <[EMAIL PROTECTED]> wrote:
>
> > > > Using the shell command-line option of web2py, one can create a daemon
> > > > with full access to the DB that the webserver has.  Is it possible to
> > > > do something similar w/ a thread created within web2py?  When I tried,
> > > > I got complaints that my db variable wasn't defined; then I tried to
> > > > include my model file, but got a complaint that it isn't a module.
>
> > > > Thanks,
> > > > Scott
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to