Re: db sever seems to be dropping connections

From: Vivek Khera <vivek(at)khera(dot)org>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: db sever seems to be dropping connections
Date: 2006-03-22 16:46:38
Message-ID: 2D73F6FA-E6DE-42F2-9743-8028C133B2FF@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces


On Mar 21, 2006, at 4:39 PM, Rushabh Doshi wrote:

> This is my problem. I have a connection to the database using DB-
> >connect.
> Apparently, this connection sits idle for around an hour or so
> because of my
> application, and after that it has to do something. So I check that
> if the
> handle is still a valid one or not. If it's not, then re-establish the

I see you're using DBI.

When you detect the dead connection, you need to close it immediately
so that later on it will not attempt a disconnect. What you probably
also want is to tell DBI not to try to do any cleanup on it since the
connection is already lost. You do this by setting

$dbh->{InactiveDestroy} = 1

before you undef $dbh.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vivek Khera 2006-03-22 16:53:43 Re: Advantages of PostgreSQL over MySQL 5.0
Previous Message Richard Jones 2006-03-22 16:40:27 ANNOUNCE: Type-safe interface to PostgreSQL

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2006-03-22 17:21:03 Re: db sever seems to be dropping connections
Previous Message Rushabh Doshi 2006-03-21 21:39:55 Re: db sever seems to be dropping connections