Re: Get status of connection (C)

From: "Tim Barnard" <tbarnard(at)povn(dot)com>
To: <zilch(at)home(dot)se>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Get status of connection (C)
Date: 2001-05-29 16:55:24
Message-ID: 006301c0e860$287c19a0$a519af3f@hartcomm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)home(dot)se>
To: <pgsql-general(at)postgresql(dot)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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Barnard 2001-05-29 17:14:20 Re: Help with C++
Previous Message Tim Barnard 2001-05-29 16:44:35 Re: Re: [SQL] Difficult SQL Statement