[ZODB-Dev] Multiple threads connecting to ZODB

Alex Couper amcouper at gmail.com
Fri Nov 25 11:30:55 EST 2005


I am having trouble creating connections from different threads to my zodb.
In the main thread, I create/get the database using this:

storage=FileStorage('my.fs')
db=DB(storage)

The main thread subsequently creates other threads, and I would like those
threads to be able to have access to the 'db' instance created in the main
thread. In that way I would be able to write:

connection = db.open() in those threads.

This is all very manageable in most of the threads that I run, as I can pass
the db instance in as an argument, however there is one thread that I have
to (for one reason or another) run using os.system and then the file name.
This means that it can have no idea about the db created in the main thread.

My last solution was that every process that required access to the database
had to open it (storage=FileStorage(...)), perform the actions that it
required, and then close the database. As you can imagine this was taking
far too long when lots of transactions were being made to the database from
multiple threads.

Any help would be great,
Thanks

Alex Couper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zodb-dev/attachments/20051125/2c3a9a3e/attachment.htm


More information about the ZODB-Dev mailing list