[Zope] Database connections

Oleg Broytmann phd@sun.med.ru
Tue, 23 Mar 1999 19:07:42 +0300 (MSK)


On Tue, 23 Mar 1999, Paul Everitt wrote:
> Oleg wrote:
> >    There are connections to different databases. So you said "one
> > connection to one database"?
> 
> If you can use one connection string in Postgres to access multiple
> databases, then you just need one Database Connection.  Otherwise,

   No. Connection string include database name, so I need one connection
for every database.

> you'll need one connection per database.  Note that I don't mean per
> table -- I don't know much about Postgres and don't know if it organizes
> tables into separate databases that are selected with a "use database"
> command.

   Yes, I see.

> > > >    It is bad, as I have many databases, so Zope eats up 
> > > > memory. Another
> > > > problem - what would do Zope if I restart Postgres (so all current
> > > > connections break)? Would Zope reestablish connections or 
> > just report
> > > > error?
> > > 
> > > It should re-establish the connection.  If it doesn't then there's a
> > > bug.  This works fine with all the Database Adapters I've used.
> > 
> >    I'll retest, but currently, when I ask ZPygresDA to close 
> > connection,
> > Zope reports "the site has technical difficulties" when I'm trying to
> > access the application.
> 
> Right, which is the correct behavior, as you had disconnected from the
> database.  I thought your question was about restarting _Zope_, so I had
> a misunderstanding.

   I meant 3 different situations:

1. I started Potsgres, then started Zope, then restarted Zope - Zope
reestablished connections. It's Ok.

2. I started Potsgres, then started Zope, then restarted Postgres. Zope
does not reestablish connections: This site is currently experiencing
technical difficulties...

3. I started Potsgres, then started Zope, then went to management screen
and explicitly close a connection. Zope does not reestablish connections.

   Situations 2 an3 could be resolved, if I go to management screes, close
and reopen database connections. But it is hard to remember "always restart
Zope if you restart Postgres"...

> --Paul
> 

Oleg.
---- 
    Oleg Broytmann  National Research Surgery Centre  http://sun.med.ru/~phd/
           Programmers don't die, they just GOSUB without RETURN.