Maciej Wisniowski wrote at 2006-9-23 00:27 +0200:
> > You could recode DA's to close the connection at the end of every
> > transaction and reopen them on demand,
>Seems for me that difference betwen "connect on load"
>and "connect on demand" is in _begin, _finish and
>__init__ methods of TransactionManager (usually defined in
>in specific database adapter).

The bad behaviour is in standard Zope code:


It connects to the database as soon as the instance is loaded from
ZODB. My modified code looks like:

    def __setstate__(self, state):
        Globals.Persistent.__setstate__(self, state)
        if self.connection_string:
            # DM 2005-06-24: what a stupidity to connect on load!
            #  It should be delayed until the connections is really used.
            #  I do not change this here to not break DAs.
            # DM 2005-06-24: "connect_" in order to protect '_v_' attributes
            #try: self.connect(self.connection_string)
            try: self.connect_(self.connection_string)
                    'Error connecting to relational database.',

Zope-DB mailing list

Reply via email to