Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8C4E063368D for ; Sat, 20 Jun 2009 05:44:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 97236-02 for ; Sat, 20 Jun 2009 05:44:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kerberos.fcon.no (165.84-49-232.nextgentel.com [84.49.232.165]) by mail.postgresql.org (Postfix) with ESMTP id 95E4B63361B for ; Sat, 20 Jun 2009 05:44:06 -0300 (ADT) Received: from [10.0.0.75] (duplo.lan [10.0.0.75]) by kerberos.fcon.no (Postfix) with ESMTP id 143F1370A6; Sat, 20 Jun 2009 10:44:04 +0200 (CEST) Message-ID: <4A3CA154.4090205@fcon.no> Date: Sat, 20 Jun 2009 10:44:04 +0200 From: Thomas Finneid User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 To: Craig Ringer CC: pgsql-jdbc@postgresql.org Subject: Re: Connection exceptions References: <54338.134.32.140.234.1245407835.squirrel@fcon.no> <1245469155.1624.6.camel@ayaki> In-Reply-To: <1245469155.1624.6.camel@ayaki> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.09 tagged_above=0 required=5 tests=AWL=-0.010, RDNS_DYNAMIC=0.1 X-Spam-Level: X-Archive-Number: 200906/74 X-Sequence-Number: 19738 Craig Ringer wrote: > Most of your question really deals with the connection pooler you're > using, rather than JDBC its self. I'd start with the documentation for > DBCP. I have looked at it, and its really poor, but I'll look for a mailing list to see if I can get answers there. Not sure if anybody here can answer this question, but one thing I dont understand is the separation between DBCP and the pooler and who do what. Apparently they are two different apache-commons packages. Anybody know anything about these details or where I can find any documentation or articles about it? > shouldn't care at what point in the process the exception was thrown. > When you catch it, you can test the SQLState to see if the error is > possibly transient and be prepared to retry the operation. (deadlocked > transaction? OK, retry. Connection broken? Obtain a new connection and > retry. etc) My main algorithm is to not care, but as soon as a problem occurs, return the connection to the pool and let the pool deal with its condition, then get a new connection and try again. Repeat three times and then fail by throwing an exception to the client (after appropriate cleanup and logging.) regards thomas