Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 34CD23540 for ; Sun, 8 May 2011 15:19:53 +0000 (UTC) Received: (qmail 16050 invoked by uid 500); 8 May 2011 15:19:49 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 15824 invoked by uid 500); 8 May 2011 15:19:48 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 15811 invoked by uid 99); 8 May 2011 15:19:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2011 15:19:48 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [81.169.162.220] (HELO h1611079.stratoserver.net) (81.169.162.220) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2011 15:19:41 +0000 Received: from [192.168.178.29] (pD9E8020E.dip0.t-ipconnect.de [217.232.2.14]) by h1611079.stratoserver.net (Postfix) with ESMTPSA id 8373349481CB for ; Sun, 8 May 2011 17:19:18 +0200 (CEST) Subject: Re: recovering connections on jdbc connection pool From: Felix Schumacher To: Tomcat Users List In-Reply-To: <6D018CA5-446F-489E-B21B-0F6251DA9A3C@gmail.com> References: <6D018CA5-446F-489E-B21B-0F6251DA9A3C@gmail.com> Content-Type: text/plain; charset="ISO-8859-15" Date: Sun, 08 May 2011 17:19:16 +0200 Message-ID: <1304867956.3954.37.camel@cat> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit Am Sonntag, den 08.05.2011, 11:42 -0300 schrieb alexis: > Hello all, is there any way to recover lost connectios on a pool? > > Here's the issue, for an application, using postgresql jdbc (same happens with mysql as i tried), having query errors syntax or duplicated keys, actually no big deal, it throws an sqlexception upon que sql error, as this call executes ~150 queries to insert, on each query i lost the connection, so suddenly i have all my connections lost and my app useless. > > How can i do from the catch clause of the SQLException to ask the pool to reconnect? Because today we are in debug stage but soon to be production and when this happens (we've corrected a lot of queries and situations but for sure some new one will arise) we need to restart the webapp. SQL Connections should not get lost when used properly. You have to close the connections and every resources you got out of that connection in case of a program error. Look for "jdbc try finally". As a helper to find connections, you did not close properly you can configure your jdbc pool to show your abandoned connections. Another safety net are the validation queries. For further information look at http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html Regards Felix > > thanks in advance. > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org