[Zope] How do I use a Z Oracle Connection in a script?

Dieter Maurer dieter@handshake.de
Sat, 14 Jul 2001 14:12:39 +0200 (CEST)


J. Cone writes:
 > Z SQL Method pastes the parameters into the request, which is
 > unsatisfactory because this parameter contains stray quotes and unprintable
 > characters.
Unprintable characters should not pose problems.
"dtml-sqlvar ... type=string" properly quotes embedded quotes.
Thus, it should work!

 > I am trying to write a python script, given an oracle connection called
 > Oracle_database_connection in the same folder.
 > 
 > I currently have AttributeError: cursor  on line 4 (really line 3) of:
Zope database connections are not themselves DB-API connections,
but are wrappers around them.

You have in fact two nested wrappers:

  1. the database adapter, derived from "Shared.DC.ZRDB.Connection".

     It is a persistent object stored in the ZODB.

  2. the "db", a non-persistent wrapper around the
     DB-API connection

Call call a database adapter to get the "db" wrapper.
The "db", then, has a product specific way to get at
the DB-API connection. Look at the code in "Products/ZOracleDA/db.py".


Dieter