[egenix-users] mxODBCZopeDA - connection on demand

M.-A. Lemburg mal at egenix.com
Fri Jan 14 14:20:21 CET 2005


Paweł Lewicki wrote:
> Hello,
> I have a problem with a connection on-demand I'm trying to establish. Is it
> possible to "automagically" free the connection after the query?
> 
> I connect using that script:
> 
>             dbDA = getattr(self, 'myConnection')         #mxODBCZopeDA
>             dbConnection = dbDA.get_connection()
>             dbConnection.query(SQL)
> 
> 
> 
> An adapter is configured as 'on demand'. I tried to call manually
> .lazy_connect() and get working connection in different ways.
 >
> The problem is that the connection stays open after the query. If I manually
> close it I have a problem with concurrent queries.

Only the connect is done on demand. After the initial connect
the connection will stay open.

The feature is intended to reduce overhead when loading connection
objects into memory.

Most other DAs (re)open the connection when loading the connection
object into memory - and this can happen even if you don't
use the object at all. mxODBC Zope DA in on-demand connect mode
will only open the connection if it is actually needed and
used for a query.

> I haven't done any long term tests so I don't know if the connecton is freed
> eventually. Is it configurable anywhere?

No, but we'll probably add something like this to one of the
next releases.

Regards,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 10 2005)
 >>> 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 mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list