[egenix-users] mxODBC Zope DA .get_connection()

M.-A. Lemburg mal at egenix.com
Tue Aug 10 21:37:39 CEST 2010


Mathias Gibbens wrote:
> Hello all,
>   
> In some of my long-running code in Zope, I'm using .get_connection() to
> get a database connection, and then run some queries. Once I'm done with
> the queries, I'd like to free up the connection for use in other
> locations until it is needed again. Is there a way to automatically free
> connections that are not being used after a period of time?
> 
> I did find a post from 2005
> <http://lists.egenix.com/mailman-archives/egenix-users/2005-January/113826.html> asking about this, but haven't been able to find anything else helpful.

You can call the .close() method on the DatabaseConnection object
you got from .get_connection(). This will then close the physical
database connection and prevent it from being reused in the connection
pool.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Aug 10 2010)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the egenix-users mailing list