pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jonathan Fuerth <fuerth@sqlpower.ca>
To: Kishore Kolli <kkolli@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: org.postgresql.util.PSQLException: An I/O error has occured while flushing the output
Date: Fri, 9 Dec 2005 15:09:08 -0500
Message-ID: <385133ace3c5280b1b2df75125cd520a@sqlpower.ca> (raw)
In-Reply-To: <6f1412eb0512081358u4d699f2bx32d722e92fd5cf54@mail.gmail.com>
References: <6f1412eb0512081358u4d699f2bx32d722e92fd5cf54@mail.gmail.com>

On Dec 8, 2005, at 4:58 PM, Kishore Kolli wrote:

>  The application dumps the following error in the following cases:
>    1. The postgres process is restarted.
>    2. The network connection between the machine running postgres and 
> tomcat has been reset.
> [...] 
> Any idea how to make tomcat reconnect to the database with out any 
> problems ?
>  

It's not a Postgres specific answer, but here's an answer nonetheless:

It appears from the stack trace that you are using the Jakarta Commons 
DBCP package.  If you set a validationQuery on your connection pool, 
the pool manager will automatically test your database connections 
before giving them to Hibernate.  If you have had a network outage or 
server restart, the pooled connections will fail that test, and the 
DBCP will dump those broken connections and open new ones before 
returning them to Hibernate.

For your validation, pick a simple query that is guaranteed to return 
at least one row, but will not be expensive to execute (because it will 
be executed frequently!).  For example, you could use "SELECT now()", 
which doesn't even require disk access.

See http://jakarta.apache.org/commons/dbcp/configuration.html for 
details on DBCP configuration.

-Jonathan=

view thread (19+ messages)  latest in thread

Message-ID: <385133ace3c5280b1b2df75125cd520a@sqlpower.ca>
Permalink:  ../385133ace3c5280b1b2df75125cd520a@sqlpower.ca/
Also on:    postgresql.org/message-id/385133ace3c5280b1b2df75125cd520a@sqlpower.ca

 · 

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: fuerth@sqlpower.ca, kkolli@gmail.com
  Subject: Re: org.postgresql.util.PSQLException: An I/O error has occured while flushing the output
  In-Reply-To: <385133ace3c5280b1b2df75125cd520a@sqlpower.ca>
  References: <6f1412eb0512081358u4d699f2bx32d722e92fd5cf54@mail.gmail.com> <385133ace3c5280b1b2df75125cd520a@sqlpower.ca>

* 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