[Zope] Database Connections

Andy Dustman farcepest at gmail.com
Wed Nov 24 15:49:06 EST 2004


On Wed, 24 Nov 2004 10:07:48 -0800, Jason Leach <jason.leach at gmail.com> wrote:

> With Psycopg I have noticed that if the DB server is restarted (or
> just the Database) that Psycopg does not re-connect very well to the
> DB.  Is  this a known problem or just on my end?  I seem to remember
> my MySQL server conneciton doing the same back when I used MySQL.

I would expect this to be a fairly common problem. With the DA
machinery, you get one connection per thread, so if the database
restarts, it is possible for the client side to not realize the
connection has gone away until the next API call. This most probably
results in an  uncaught exception.

In ZMySQLDA, you can probably avoid this problems by doing conn.ping()
(I forget the exact name of the connection) in the _begin method. This
should re-open the connection if it has gone away. I don't know
PostgreSQL/Psycopg well enough to know if something equivalent exists
there, but it doesn't look like it.

Maybe if I'm feeling industrious I'll release ZMySQLDA-2.0.9 this week. 
-- 
Computer interfaces should never be made of meat.

Using GMail? Setting Reply-to address to <> disables this annoying feature.


More information about the Zope mailing list