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.
In response to
pgsql-jdbc by date
|Next:||From: Russell Francis||Date: 2005-12-10 17:25:47|
|Subject: PGinet, PGcidr & PGmacaddr contributions|
|Previous:||From: Michael Paesold||Date: 2005-12-09 09:43:52|
|Subject: Re: Problem with 8.1 driver|