[Zope] FAQ: How to use database connections directly

Johnny Wezel j@starfish.ocean
Thu, 14 Oct 1999 15:04:13 +0200


I'm a newbie to Zope and try to access a database from my ZClass.

I tried to access a database connection by finding it with SQLConnectionsIDs
and then applying the connection object's query method with an SQL statement
and finally returning the result. This caused an endless loop in the server.
So I assume that's not the right way to do it. Can I do that at all without
adding a ZSQL Method?

If it doesn't work without a ZSQLMethod, how can I add one in an external
method (I don't want to bother with ZSQLMethods when creating my object) if I
already have a reference to the database connection? I would do that in the
ZClass constructor.

Thanks

--
Johnny Wezel
jwezel @ gmx.ch
jwezel @ mail.com
jay @ rocknrollband.com