[Zope-dev] Making a ZSQL.DA fully multi-threaded?

Brad Clements bkc at murkworks.com
Fri Jul 9 09:35:37 EDT 2004


I am using ZsapdbDA with SAPDB (now MaxDB) and have run into problems when Zope 
has more than one thread.

The folks at SAP suggest that there should be one database connection per thread, rather 
than sharing one connection across threads.

I haven't yet looked at the Zsapdb source, but I think it has only one connection for all 
threads.

Is there a document somewhere that explains how to make variables "thread private" in 
Zope? I vaguely recall something about one cache per thread, or that variables are read-
only shared unless updated by a thread, and then they're copied.. This is probably quite 
wrong, but obviously I just don't understand how data and threading works in Zope.

So, I'm looking for a document that explains this clearly. How to have data that is not shared 
between threads (perhaps a kind of connection pool thingy).


Also, I have other projects where I really want to have just one object of it's kind no matter 
how many threads. For example, gvibDA uses Thunked_TM for this, but that doesn't really 
work with ZSQLDA because I've seen that multiple connect calls are made, even with the 
THUNKED_TM.

Is there a "Zen Of" document about this somewhere?

Thanks



-- 
Brad Clements,                bkc at murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
http://www.wecanstopspam.org/                   AOL-IM: BKClements



More information about the Zope-Dev mailing list