[Zope] Connecting to a MaxDB Database via ODBC (porting old C++ application to Zope)

Dieter Maurer dieter at handshake.de
Sun Dec 5 13:28:52 EST 2004


Hermann Himmelbauer wrote at 2004-12-5 11:48 +0100:
> ...
>My web application should on one hand access the database directly via a Zope 
>Database Adapter and on the other hand use functions from this C++ Client 
>which also accesses the database. (Some functions of this C++ Client are 
>compiled as a library which can then be called from Zope).
>
>What I now need is a way to access my Database over one Database connection.

Why?

>What I am thinking of is to use some Zope Database Adapter that uses ODBC, and 
>give the database handle to my C++ functions.

Should your C++ functions manage transactions, this would be a recipe
for desaster (I exaggerate a bit).

>My problem is: How would I get the ODBC Database handle from the Zope Database 
>Adapter object?

This is not a Zope question at all but a question relating
to the specific database adapter object you plan to use
(I recommend "mxZODBCDA"; it is commercial, but *much* better
than the free "ZODBCDA").

I do not use ODBC (and related DAs) and therefore cannot answer
the specific question.

>Is this easy to do?

I would not do it.

Instead, I would use independent connections, both tied in
to Zope's transaction system.

This, too, would require that your C++ functions do not have
their own understanding of transactions.

>Will I run into problems by doing this?

You will need to find out yourself, I fear....

>Moreover I don't know if there's a ODBC Database adapter available which is 
>compatible to Zope and to MaxDB.

Fortunately, the DA depends only on ODBC and not the database system
accessed via ODBC (unless there are no reliable ODBC drivers
for this database system).

Look for "mxODBC".


-- 
Dieter


More information about the Zope mailing list