[Zope] How do I use a Z Oracle Connection in a script?
Dieter Maurer
dieter@handshake.de
Mon, 16 Jul 2001 20:37:31 +0200 (CEST)
J. Cone writes:
> I am sorry to be so ignorant, but your second suggestion defeats me, so far.
Sorry to have caused confusion.
Apparently, I do that sometimes...
> db0=Shared.DC.ZRDB.Connection
> c=db0.cursor
When I said, that a Zope Database Adapter instance is
a "Shared.DC.ZRDB.Connection.Connection" instance,
it did not mean, that you should access it this way.
I wanted to give you a hint, where to look for the sources.
Looking at the sources (the available methods) gives
you a feeling how to use it.
>
> which get me the errors:
>
> Error Type: NameError
> Error Value: Shared
"Shared" is a Python package. You must import it, before
you can use it. As said above, you do not use it for your
current problem, but if you need to, you would do something
like:
from Shared.DC.ZRDB.Connection import Connection
I do not have the DCOracle sources here (at home),
therefore the following is only right in principle.
You will need to look at the sources to find out the details.
Assume you are in an external method, and "da" already contains
a Z OracleDA instance.
You call it, to get the lower level wrapper:
db= da()
This "db" object has attributes that represent the
low level DB-API connection and a cursor for it.
Maybe the attributes are "cursor" (or "Cursor")
and "connection" (or "Connection" or "Conn" or ...).
Look at the sources in "Products/ZOracleDA/db.py"!
Dieter