[Zope-DB] Mixing ZSQLMethods with ZOracleProcedures: Problem and Patch

Dieter Maurer dieter at handshake.de
Sun Dec 7 13:00:31 EST 2003


Willi Langenberger wrote at 2003-12-6 23:22 +0100:
> ...
>We encountered a problem when we use a ZOracleProcedure and a
>ZSQLMethod in the same script. Sometime it happens, that one of them
>doesn't see the changes from the other one. Example:
> ....
>The reason for this seems to be the differnt way these objects get the
>low level database connection (db):
>
>- ZSQLMethod: gets the db object on every call from the zope "database
>  connection object"
>
>- ZOracleProcedure: gets the db object from the zope "database
>  connection object" on the first call, but caches it then (in _v_db)
>
>Is this possible?

Even very likely!

  When the DA object is flushed from the ZODB cache,
  the "ZOracleProcedure" keeps the old connection.

  When the DA object is later reloaded from ZODB,
  it creates a new connection. From then on,
  Z SQL Methods and "ZOracleProcedures" use independent
  connections to Oracle. This looks like what you describe.

Usually (unless the object is modified) you can force an
object to be flushed from the ZODB cache by calling
its "_p_deactivate()" method.
This can help you to easily reproduce the problem and
to check that your modification solved the problem.

-- 
Dieter



More information about the Zope-DB mailing list