Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 380F99FA617 for ; Wed, 11 Oct 2006 13:00:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 45814-09 for ; Wed, 11 Oct 2006 13:00:44 -0300 (ADT) X-Greylist: delayed 00:25:32.731361 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4EFA09FB3A2 for ; Wed, 11 Oct 2006 13:00:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from apriorit.dp.ua (unknown [195.248.175.46]) by svr4.postgresql.org (Postfix) with ESMTP id 3A1685AF041 for ; Wed, 11 Oct 2006 15:35:03 +0000 (GMT) Received: from SAINT by apriorit.com (MDaemon PRO v9.0.4) with ESMTP id md50000364989.msg for ; Wed, 11 Oct 2006 18:33:17 +0300 Date: Wed, 11 Oct 2006 18:33:13 +0300 From: Dmitriy Chumack X-Mailer: The Bat! (v3.0.1.33) Professional Reply-To: Dmitriy Chumack Organization: Apriorit X-Priority: 3 (Normal) Message-ID: <95520488.20061011183313@apriorit.com> To: pgsql-interfaces@postgresql.org Subject: libpq - check PGconn* - is it valid MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Authenticated-Sender: saint@apriorit.com X-Spam-Processed: apriorit.dp.ua, Wed, 11 Oct 2006 18:33:17 +0300 (not processed: message from valid local sender) X-Return-Path: saint@apriorit.com X-MDaemon-Deliver-To: pgsql-interfaces@postgresql.org X-MDAV-Processed: apriorit.dp.ua, Wed, 11 Oct 2006 18:33:18 +0300 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200610/6 X-Sequence-Number: 6289 Hi everyone. I have such a problem. My application, some server, use libpq librarry to interact with PostgreSQL-8.1.0 database. Postgresql server and my server work on different computers in the local network. When my server starts, it creates pool of 10 connections to database. My server use PQexec() to submit queries to db. But when there is no network connection to the database (I simply unplug the network cable from computer on which PG server is run) and my server calls PQexec() - than it hangs in PQexec() call. And it will hang there for a very long time (I wait about 30 minutes and there is no result). And when I plug in the network cable back, PQexec() remains hanging (I wait about 10 minutes and there is no result too). I use simply (not ssl) connection to db. So how can I check PGconn pointer if it represent a health connection to prevent my server to hang in PQexec() call? Thanks in advance. -- Best regards, Dmitriy Chumack mailto:saint@apriorit.com Software Developer of ApriorIT