[Zope-DB] Problems with transaction management and many database adapters

M.-A. Lemburg mal at egenix.com
Tue Feb 3 04:55:26 EST 2004

Marco Bizzarri wrote:
> Hi all.
> I think we have found some problem in the management of the transactions 
> with databases. The problem show both with  zpsycopg (1.1.10), zpopy 
> (2.0.8) and zmysqlda (2.0.8)
> You can test the problem importing the attached zexp. It has a psycopg 
> connection to a db (named PAFlow), and a SQL Method which queries a 
> table called entita. The problem is not in the nature of the sql, but 
> how the sql method is called:
> we have a page template (index_html) which calls a dtml 
> (standard_html_header) which calls a page template (menu_html) which 
> calls the SQL method.
> Look at the log of your postgres/mysql db: there are two transactions: 
> the first one correctly finishes, the second one remains open and idle. 
> If you visit again the page, there is an abort in your log, a new 
> transaction which closes correctly, and another transaction which 
> remains open.
> Any suggestion about this problem?

If "abort" means that the transaction in the database is rolled back,
then I don't see any problem: transactions are usually created
implicitly, ie. if you commit or rollback a transaction, the database
automatically starts a new one which, of course, remains open until
the next request comes in.

Now, some DAs may continue using the already opened transactions
or start a new one by forcing a rollback or a reconnect. Others,
like the mxODBC Zope DA, may not because, it's really unnecessary.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Feb 02 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
2004-01-23: Released mxODBC.Zope.DA 1.0.8        http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Zope-DB mailing list