[Zope] Releasing the database connection after processing a request

Dieter Maurer dieter at handshake.de
Thu Dec 4 16:16:35 EST 2003


Florian Reiser wrote at 2003-12-4 11:04 +0100:
>from time to time, I have to access my database exclusive.
>So I shutdown zope, do my database work, and then start zope.
>Can I convince Zope to release the database connection each time, it has
>processed a request successfully? So I won't have to shutdown zope to do my
>administration work?

You can do this in principle, although it may be a bit of work:

  By default, a Zope DA instance connects to the database as
  soon it is loaded (from ZODB). The remaining code
  can thus assume that there is always an open connection.

  You must remove this "auto connect" to get what you want.
  Therefore, you must check all accesses to the connection
  and ensure, the database is connected on demand.

  In the "commit/abort" methods, you can then close
  the connection again.

-- 
Dieter



More information about the Zope mailing list