X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A129A11F6C2C for ; Mon, 10 Apr 2006 12:54:39 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.12 X-Spam-Level: X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id kf6p82yMeyzi for ; Mon, 10 Apr 2006 12:53:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 0890411F693D for ; Mon, 10 Apr 2006 12:53:18 -0300 (ADT) Received: from kingfisher.intern.logix-tt.com (p549D1FA2.dip0.t-ipconnect.de [84.157.31.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 24F5D656C0; Mon, 10 Apr 2006 17:54:09 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 6C1C5181520C4; Mon, 10 Apr 2006 17:53:30 +0200 (CEST) Message-ID: <443A7F7A.6090509@logix-tt.com> Date: Mon, 10 Apr 2006 17:53:30 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Markus Riehl Cc: pgsql-jdbc@postgresql.org Subject: Re: No automatic reconnect after network error References: <003301c65cb1$038f0830$15b2a8c0@pcmar02> In-Reply-To: <003301c65cb1$038f0830$15b2a8c0@pcmar02> X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archive-Number: 200604/77 X-Sequence-Number: 15011 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: boo jdbc:postgresql://localhost:5432/bar [ ... other attributes ... ] SELECT version() SELECT version() 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. HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org