Re: org.postgresql.util.PSQLException: An I/O error has occured while flushing the output - Mailing list pgsql-jdbc

From Kishore Kolli
Subject Re: org.postgresql.util.PSQLException: An I/O error has occured while flushing the output
Date
Msg-id 6f1412eb0512120958r1ee56d22gc531dca5d7187388@mail.gmail.com
Whole thread Raw
In response to Re: org.postgresql.util.PSQLException: An I/O error has occured while flushing the output  (Jonathan Fuerth <fuerth@sqlpower.ca>)
List pgsql-jdbc
Thanks a bunch.. That worked.

-kishore

On 12/9/05, Jonathan Fuerth <fuerth@sqlpower.ca> wrote:
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

pgsql-jdbc by date:

Previous
From: Russell Francis
Date:
Subject: PGinet, PGcidr & PGmacaddr contributions
Next
From: Heikki Linnakangas
Date:
Subject: Re: pgsql XA with weblogic 8.1?