Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D5FCD632EA6 for ; Sun, 2 Aug 2009 06:25:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 26048-10 for ; Sun, 2 Aug 2009 09:25:32 +0000 (UTC) X-Greylist: delayed 00:12:28.521698 by SQLgrey-1.7.6 Received: from mail.UniCell.local (unknown [212.199.51.242]) by mail.postgresql.org (Postfix) with ESMTP id 03930632486 for ; Sun, 2 Aug 2009 06:25:31 -0300 (ADT) Received: from herouth.localnet ([192.168.34.34]) by mail.UniCell.local with Microsoft SMTPSVC(6.0.3790.3959); Sun, 2 Aug 2009 12:10:56 +0300 From: Herouth Maoz Organization: Unicell To: pgsql-jdbc@postgresql.org Subject: How to retry when connection has been closed? Date: Sun, 2 Aug 2009 12:12:55 +0300 User-Agent: KMail/1.11.4 (Linux/2.6.27.21-desktop-1mnb; KDE/4.2.4; i686; ; ) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908021212.56184.herouth@unicell.co.il> X-OriginalArrivalTime: 02 Aug 2009 09:10:56.0517 (UTC) FILETIME=[24DC3350:01CA1351] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.1 tagged_above=-10 required=5 tests=RDNS_NONE=0.1 X-Spam-Level: X-Archive-Number: 200908/2 X-Sequence-Number: 19851 Good day. We are upgrading a legacy system from Sybase to Postgres. In one of the modules, we wish, if an SQLException is caught, to close and reopen the connection and retry - but only if the cause of the Exception is a dropped connection. The original developer of the code implemented this by searching for the substrings "Broken pipe" or "Connection already closed" in the exception message. Is there a more elegant way to find out whether the connection has been dropped from within the catch clause? And if not, I assume the above substrings are no longer pertinent - what messages in PostgreSQL indicate a dropped connection? Thank you, Herouth