Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 84547 invoked from network); 4 Nov 2008 22:35:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Nov 2008 22:35:08 -0000 Received: (qmail 56979 invoked by uid 500); 4 Nov 2008 22:35:02 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 56945 invoked by uid 500); 4 Nov 2008 22:35:02 -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 56934 invoked by uid 99); 4 Nov 2008 22:35:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Nov 2008 14:35:02 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Nov 2008 22:33:45 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KxUTi-0003zk-Kx for users@tomcat.apache.org; Tue, 04 Nov 2008 14:34:26 -0800 Message-ID: <20332763.post@talk.nabble.com> Date: Tue, 4 Nov 2008 14:34:26 -0800 (PST) From: Flavio Reis To: users@tomcat.apache.org Subject: Re: refresh bad db connection on tomcat - urgent help In-Reply-To: <48EF70E1.4030808@christopherschultz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: flavio.bnu@ibest.com.br References: <19640888.1223648987698.JavaMail.root@elwamui-little.atl.sa.earthlink.net> <48EF70E1.4030808@christopherschultz.net> X-Virus-Checked: Checked by ClamAV on apache.org Hi Srinivas, Have you already solved this problem? I have the same, an i can`t get the solution. Regards. Christopher Schultz-2 wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Srinivas, > > Srinivas Jonnalagadda wrote: >> what is the syntaxt to refresh bad db connection on tomcat - >> context.xml? We are using tomcata 5.5.9 connecting to oracle 10. The >> issue is that our jvm crashed because in the connection pool we had >> bad db connection and it the connections were out of limit. we could >> not detect and it happened in our prod environment. if there is any >> command for that it would be great help. > > Just to be clear: you ran out of database connections, or your database > connections went stale and you just need to replace one connection at a > time? > > If you are getting stale connections, you just need to set a "validation > query" in your connection configuration. In your application's > META-INF/context.xml, you should have a element which defines > your data source (this may also be in Tomcat's server.xml if you have a > global data source). Just add > > validationQuery="SELECT 1 FROM DUAL" > > to detect stale connections. The query itself is irrelevant, except that > it needs to return successfully and you want something that's not going > to put a load on the server. Some drivers/servers support a 'ping' query > that is super lightweight (for instance, recent versions of MySQL's > Connector/J allows a query starting with '/* ping */' to be used as a > lightweight communications check). > > If you are leaking connections from your pool, you should review your > application for proper try/finally processing of JDBC connections. > Tomcat's connection pool (which is really commons-dbcpo in disguise) can > help you find places where connection are being leaked using a few other > attributes: > > logAbandoned="true" > removeAbandoned="true" > removeAbandonedTimeout="30" > > These settings tell the connection pool that it should keep track of > where connections are borrowed from the connection pool. If the > connection hasn't been returned to the pool within > "removeAbandonedTimeout" seconds, then the connection will be purged > from the pool, and a stack trace showing the code that borrowed the > connection will be dumped into your log. > > See http://commons.apache.org/dbcp/configuration.html for more > information. > > Hope that helps, > - -chris > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkjvcOEACgkQ9CaO5/Lv0PDVWACfTxkUIKm/M6mcGVnFQ9yQjsKe > RfYAnjnaW8aSH4ZGOJqrg4GAXshyasyk > =FsRS > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > > -- View this message in context: http://www.nabble.com/refresh-bad-db-connection-on-tomcat---urgent-help-tp19919463p20332763.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org