Releasing the database connection after processing a request
Hello Zopistas, 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? Regards Florian Reiser
On Thu, 4 Dec 2003 11:04:33 +0100 "Florian Reiser" <florian.reiser@ra-unternehmensberatung.com> wrote:
Hello Zopistas,
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?
Can you not close the database connection from the DA's management screen? What database are we talking about? -Casey
Hello Casey, we are talking about M$ VFP. I access it with the crappy odbc driver bundled with it. If I close it from the database screen, nothing changes, because the object is still in cache. Dead, but existing. A common ugly practive with VFP is, that you can copy its tables/files to do updates. While copying nobody should have the database or a single table open. So it would ease the thing a lot, if zope would release the database connection after each request. Then the files get closed. Regards Florian Reiser -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Casey Duncan Sent: Thursday, December 04, 2003 3:25 PM To: florian.reiser@ra-unternehmensberatung.com Cc: zope@zope.org Subject: Re: [Zope] Releasing the database connection after processing a request On Thu, 4 Dec 2003 11:04:33 +0100 "Florian Reiser" <florian.reiser@ra-unternehmensberatung.com> wrote:
Hello Zopistas,
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?
Can you not close the database connection from the DA's management screen? What database are we talking about? -Casey _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
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
participants (4)
-
Casey Duncan -
Dieter Maurer -
Florian Reiser -
Florian Reiser