Skip site navigation (1) Skip section navigation (2)

Re: No automatic reconnect after network error

From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: Markus Riehl <mriehl(at)skat(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: No automatic reconnect after network error
Date: 2006-04-10 15:53:30
Message-ID: (view raw or whole thread)
Lists: pgsql-jdbc
Hi, Markus,

Markus Riehl wrote:

> Using MySQL or SAPDB, the JDBC driver is automatically reconnecting to the
> database when the connection is up again. Is there a way to use the PSQL
> driver the same way?

Currently, the backend cannot keep the current transaction if the
connection breaks, so it will be rolled back.

> How is this problem handled within Connection Pools (used within a servlet
> environment)? Is the pool deleting "dead" connections automatically and is
> creating new ones?

At least JBoss, you can use the following approach: In the Datasource
definition, put the following:

    [ ... other attributes ... ]
    <new-connection-sql>SELECT version()</new-connection-sql>

This validates the connection before it is handed out on the
application, and throws away invalid connections. Be aware that the SQL
is case sensitive, we had a problem with earlier versions of OpenMDX/CRX
that had upper case letters in the tags so they were ignored by jboss.

Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU!

In response to


pgsql-jdbc by date

Next:From: Michael SchmidtDate: 2006-04-10 16:52:51
Subject: Re: Re; pg_dump from Java
Previous:From: Markus RiehlDate: 2006-04-10 15:11:15
Subject: No automatic reconnect after network error

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group