[Zope] DCOracle2 and processes
Scott Pierce
scott.pierce@sonopress.com
05 Mar 2003 13:53:24 -0500
This might be a database connection/zope thing or specifically a
DCOracle2 thing but here goes.
When creating a product I generally create a 'SQL' directory and
programatically within the product initialization add zsqlmethods to the
directory.
Then within the product I will reference the SQL directory with a
getattr. Early on I was doing this where ever necessary vs. putting it
in the __init__ and referencing it from the class. Doing the former
causes an Oracle connection for each time it is referenced.
So if I have a method within a class called by a DMTL page that does
something like:
sqlF = getattr(self, 'SQL')
then
sqlf.runazsqlmethod()
A process is created with an Oracle connection each time the page is
hit. I have moved these into the __init__ like so:
self.sqlF = getattr(self, 'SQL')
then:
self.sqlF.runazsqlmethod()
w/out this problem and that makes sense. However, I would still like to
get some idea why the connections get created just referencing it the
way I previously had it.
Any insights?
--
Scott Pierce <scott.pierce@sonopress.com>
Sonopress LLC