Re: Get status of connection (C) - Mailing list pgsql-general

From Tim Barnard
Subject Re: Get status of connection (C)
Date
Msg-id 006301c0e860$287c19a0$a519af3f@hartcomm.com
Whole thread Raw
In response to Get status of connection (C)  (zilch@home.se)
List pgsql-general
Page 4 of the programmers reference states:
"At any time during connection, the status of the
connection may be checked, by calling PQstatus."
I use it and so far its worked great, by which I mean
it has subsequently reported bad connections after
having reported CONNECTION_OK, which has
happened when the backend has died.

Tim

----- Original Message -----
From: <zilch@home.se>
To: <pgsql-general@postgresql.org>
Sent: Tuesday, May 29, 2001 2:46 AM
Subject: [GENERAL] Get status of connection (C)


>
> I'm writing a pool manager to manage x connections to a pgsql postmaster.
>
> The getConnection method has to check if the connection is still valid,
> and try to reconnect if it ain't.
>
> Do you guys have a good way of doing this?
>
> Can I use PQstatus?
>
> Should I make a little runCommand on it to try it out? Then what command?
>
> If it's bad, should I run a PQfinish on it before reconnecting or not?
>
> Thank you plenty!
>
> ---
> Daniel Akerud
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


pgsql-general by date:

Previous
From: "Tim Barnard"
Date:
Subject: Re: Re: [SQL] Difficult SQL Statement
Next
From: Arcady Genkin
Date:
Subject: Changing path to /tmp/.s.PGSQL.5432 file and the .lock file