pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@unicell.co.il>
To: pgsql-jdbc@postgresql.org
Subject: How to retry when connection has been closed?
Date: Sun, 2 Aug 2009 12:12:55 +0300
Message-ID: <200908021212.56184.herouth@unicell.co.il> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <200908021212.56184.herouth@unicell.co.il>
Permalink:  ../200908021212.56184.herouth@unicell.co.il/
Also on:    postgresql.org/message-id/200908021212.56184.herouth@unicell.co.il

 · 

reply

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-jdbc@postgresql.org
  Cc: herouth@unicell.co.il
  Subject: Re: How to retry when connection has been closed?
  In-Reply-To: <200908021212.56184.herouth@unicell.co.il>
  References: <200908021212.56184.herouth@unicell.co.il>

* 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