From: Sascha Schumann <sas@schell.de>
To: pierre@desertmoon.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] connection timeout?
Date: Sat, 13 Feb 1999 15:55:35 +0100
Message-ID: <19990213155535.A1310@schell.de> (raw)
In-Reply-To: <19990213010342.19457.qmail@desertmoon.com>
References: <19990213010342.19457.qmail@desertmoon.com>
On Fri, Feb 12, 1999 at 06:03:42PM -0700, pierre@desertmoon.com wrote:
> All,
>
>
> Is there a connection timeout on the client code? That is if I were
> to leave the client running but idle for a period of time I'd like
> the client to time out and quit....is there anything like that
> in PostgreSQL, can it be added?
>
> -=pierre
I've employed the following method in one program (it's a CGI which may stay
longer around without using the database connection):
-----
PGconn *conn;
void sig_alrm(int nr)
{
signal(SIGALRM, SIG_DEF);
if(conn)
PQfinish(conn);
conn = NULL;
}
void use_pgsql(void)
{
if(!conn) {
conn = PQconnectdb(...);
signal(SIGALRM, sig_alrm);
}
alarm(60);
}
-----
Before you use any database action now, you call use_pgsql() which will start
the counter and set up the connection.
--
Regards,
Sascha Schumann |
Consultant | finger sas@schell.de
| for PGP public key
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: sas@schell.de, pierre@desertmoon.com
Subject: Re: [SQL] connection timeout?
In-Reply-To: <19990213155535.A1310@schell.de>
References: <19990213010342.19457.qmail@desertmoon.com> <19990213155535.A1310@schell.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox