[Zope-DB] opening and closing a database connection from a dtml-method

Matthew T. Kromer matt@zope.com
Wed, 19 Sep 2001 09:27:18 -0400


Thomas_Janke@prisma-edv.de wrote:

>
>
>Hi,
>
>I would like to know how to open and close a connection say, with a
>mouse-click on a dynamic web-page E.g., in a form.
>
>Thanks
>
This is actually a lot trickier than you might think with Zope.  The 
reason is that Zope's RDBMS support does not have an "administrativly 
closed" state on connections -- each time a connection is  needed, it 
will be opened if it is not already open.  So, if you acquire a 
connection object (e.g. by name) and replace its connection string with 
an invalid one, you'll "close" the connection -- but that's not really 
what you want, I dont think.