[Zope-DB] Basic tsql example using MxODBC Zope DA adaptor?

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Fri Jan 5 18:36:30 EST 2007


Please, stay on zope-db list :)

> Thank you for your assistance.  I plugged in the new code, using the
> example you forwarded, and everything seems to work fine, without
> errors,and navigates to my results-page.  The problem, however, is
> that nothing changes in the DB.
It is not possible (at last in easy way) to look into mxODBC code so I'm
not sure how it's API is... Instead of commit and rollback try to call:

_finish() - to commit
abort() or _abort() - to rollback.

It may be necessary to call these functions from external method (not
from Script (Python)) because you'll get unauthorized exception.

These are functions of Zope transaction managers
(lib/python/Shared/ZRDB/DC/TM.py). Typically (so I suppose mxODBC does
this too), call to Database Adapter object like:
mxODBCDatabaseConnection()
returns transation manager. Transaction manager holds real database
connection object and is able to call commit or rollback on it.

Have you read pdf files that are
available with mxOdbc? Maybe you'll find some clues there.

> Should "mxODBCDatabaseConnection()" be my actual DB adaptor or should
it be
> a method used to call it?
DB adapter

In fact you may also use direct python mxODBC API without any
mxODBCZopeDA features (there are examples in mxODBC docs).
Just write a python script (without zope) that does what you need and
then plug it into Zope as external method (or product).

-- 
Maciej Wisniowski

> Maciej,
> 
> Thank you for your assistance.  I plugged in the new code, using the
> example you forwarded, and everything seems to work fine, without errors,
> and navigates to my results-page.  The problem, however, is that nothing
> changes in the DB.
> 
> Should "mxODBCDatabaseConnection()" be my actual DB adaptor or should it be
> a method used to call it?
> 
> Also, if it should be a separate method, would I want to use a Controller
> Python Script if I am trying to call it from a form?
> 
> 
> Thank you and Best Regards,
> 
> Chris Nethery



More information about the Zope-DB mailing list