[Zope-Perl] ZOPE DBI adapter - feedback and patch (please rev iew)

Gisle Aas gisle@ActiveState.com
30 Aug 2000 23:03:15 +0200


Harry Danilevsky <hdanilevsky@siichi.com> writes:

> I tried Zope DBI adapter with Sybase , and it works fine, but there
> is a problem: every time the connection object is used, a new
> connection is made ( I can see it when I run sp_who in Sybase).

Does the ZDBI_DA.DB.__init__() function run each time (it should print
some noise on stdout currently)?

Might it be something that happens inside the DBI dbh handle?

> Do you see this behavior with Oracle?
> How is the db connection persistence implemented in Zope ?

All behaviour is inherited from the
Shared.DC.ZRDB.Connection.Connection class.  You can try to take a
look at the source.

> Should the specific adapter take care of it (a la Apache::DBI persistent
> connections)
> or the base class does it? If I use digicool's "native" SybaseDA,
> no extra connections are open.

I don't know.

> Problem #2. I still can't figure out how to use the DBI connection object in
> perl methods.
> If I pass the connection to perl method, I get a Python::Object object,
> but if I try to call a DBI method on it (prepare, execute, etc.), I get an
> error message telling
> me that the object doesn't support such methods.

It is not a DBI object.  It is a Shared.DC.ZRDB.Connection.Connection
object which contains a DBI dbh object somewhere.  You need to use the
API it provide.

If you want to use DBI connections directly then just use DBI directly
from perl, possible with some globals holding $dbh's to keep the
connections open between requests.  Or write a little module similar
to Apache::DBI that you use.

Regards,
Gisle