opened connection

Поиск
Список
Период
Сортировка
От Levente Kovacs
Тема opened connection
Дата
Msg-id 20120930185435.2762c7f7@jive.levalinux.org
обсуждение исходный текст
Ответы Re: opened connection  (Nathan Wagner <nw@hydaspes.if.org>)
Re: opened connection  (Darren Duncan <darren@darrenduncan.net>)
Список pgsql-general
Dear List,


I've been using PostgreSQL for quite while, but I'd need some direction on
how to handle an opened socket to the database in longer periods.

I open the connection to my database with PQconnectdb().

I access the database, everything is fine. However, if I don't access the
database for a long time (measured in days), the connection is broken. I
get this error message:

SQL action failed: 'FATAL:  terminating connection due to administrator
command SSL connection has been closed unexpectedly.

I tried to check the connection by PQstatus() before calling PQexec(), but
this doesn't detect the broken connection.

How can I detect this problem?

Is it wise to terminate the connection each time the PQexec() finished?
Should I keep the connection for say 1hour, then terminate it?
Is there a common practice?

Any guides are welcome.

Thank you,
Levente

--
Levente Kovacs
CTO, CSO
http://levente.logonex.eu


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: transitive pruning optimization on the right side of a join for partition tables
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: Would my postgresql 8.4.12 profit from doubling RAM?