Skip to Content.
Sympa Menu

devel - Re: [sympa-dev] problem with postgres

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Olivier LACROIX <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-dev] problem with postgres
  • Date: Thu, 30 Sep 1999 17:50:58 +0200


Dans son message, Raphael Hertzog ecrivait :
----------------------------------------------
*> Le Thu, Sep 30, 1999 at 03:44:52PM +0200, Olivier LACROIX écrivait:
*> > But if the postgres daemon (postmaster) is stopped and restarted, the
prob
*> lem
*> > appears again.
*> >
*> > Is this problem exist only with postgres ?
*>
*> Certainly not. I have no patch but I suggest that you use the ping method
*> from DBI in order to check if the connection is still good :
*>
*> ping
*>
*> $rc = $dbh->ping;
*>
*> Attempts to determine, in a reasonably efficient way,
*> if the database server is still running and the
*> connection to it is still working. Individual drivers
*> should implement this function in the most suitable
*> manner for their database engine.
*>
*> The default implementation currently always returns
*> true without actually doing anything. Actually it
*> returns "0E0" which is true but zero. That way you can
*> tell if the return value is genuine or just the
*> default.
*>
*> Very few applications would have any use for this
*> method. See the specialist Apache::DBI module for one
*> example usage.
*>
*>
*> Cheers,
*> --
*> Raphaël Hertzog >> 0C4CABF1 >> http://tux.u-strasbg.fr/~raphael/
*> <pub> CD Debian : http://tux.u-strasbg.fr/~raphael/debian/#cd </pub>

Thanks.

I have successfully tested to change the "Check database connection" like
this
:
unless ($dbh and $dbh->{Active} and $dbh->ping) {
return undef unless &db_connect();
}

With this method, the connection is restarted.

Now the problem is what must be made : change the method $dbh->{Active} by
$dbh->ping ?

Is this method enough efficient (speed) ?
--

Olivier LACROIX

C.I.R.I.L.
Cellule Réseau StanNet
Chateau du Montet | Tel : +33 3.83.44.74.29
Rue du Doyen Roubault | Fax : +33 3.83.44.02.62
F - 54500 VANDOEUVRE | email : address@concealed





Archive powered by MHonArc 2.6.19+.

Top of Page