Roger,

Steve is right. As a user of SQLite, I know that the DB handles are not
thread safe, and you will need to move the opening context into each of
the threads, not globally copying it. Keep in mind that there may be
certain delays in place if the 2 threads access the DB at the same time.
I would also suggest making _very_ sure you are using the latest SQLite
in your DBI/DBD.

I've got a program that runs 3 intercommunicating threads, but only one
of which accesses the DB at any given time, and only for short periods.
But, I know it can be done from multiple threads at once. Just be
careful. And, if possible, refactor code so that it runs only in one
thread.

Jason P.


-----Original Message-----

The only way I have got this to work is to open the database connection
in the thread.

Steve Lloyd
http://www.basgetti.com

Since both threads will be accessing the same database, would I need to
connect and then close the database handle every time I query it or can
the handle be left open? add as far as accessing the database, I will
only need to access it for short periods of time also. I do believe the
main thread actually only access one table within the database, whereas
the sub-thread is what requires the other tables, I could seperate the
tables into different databases, although I would rather have just the
one data.db file to transport with my script. I am not sure what the
latest version of SQLite. I am using ActiveState v5.8 Build 816 and I
installed the DBD::SQLite module using ppm and the ppm repository states
it is version 1.11, although I can't find a version any where else.

I have also seen a DBD::SQLite2 within the repository and I am wondering
how it is different from the original, I guess I'll have to research
that, but if anyone knows. Does SQLite2 support threading?

Roger Mayfield


Reply via email to