Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 35640 invoked from network); 3 Dec 2003 18:09:18 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 3 Dec 2003 18:09:18 -0000 Received: (qmail 96614 invoked by uid 500); 3 Dec 2003 18:08:53 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 96595 invoked by uid 500); 3 Dec 2003 18:08:53 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 96580 invoked from network); 3 Dec 2003 18:08:53 -0000 Received: from unknown (HELO astra.telenet-ops.be) (195.130.132.58) by daedalus.apache.org with SMTP; 3 Dec 2003 18:08:53 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by astra.telenet-ops.be (Postfix) with SMTP id 073CA37E51 for ; Wed, 3 Dec 2003 19:08:56 +0100 (MET) Received: from pandora.be (D5E05DC5.kabel.telenet.be [213.224.93.197]) by astra.telenet-ops.be (Postfix) with ESMTP id A969338098 for ; Wed, 3 Dec 2003 19:08:55 +0100 (MET) Message-ID: <3FCE26AA.60109@pandora.be> Date: Wed, 03 Dec 2003 19:08:42 +0100 From: Dirk Verbeeck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: DBCP Pool - Releasing connections References: <20031202174047.86896.qmail@web41612.mail.yahoo.com> In-Reply-To: <20031202174047.86896.qmail@web41612.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N All the test* properties require the validation parameter to be set. Test while idle does the test in background if the overhead of testOnBorrow is too large. But your best bet is to close the datasource like Larry suggested or to restart when the database is available again . -- Dirk Swaminathan Gurumoorthy wrote: > Can I use 'testOnBorrow' to validate the connection. The documentaion says it is 'true' by default. Will this parameter work only with 'validationQuery '? > > I wish DBCP has a 'releaseStale' parameter similar to the 'removeAbandoned' . This may eliminate the overhead on 'testOnBorrow'. > > TIA > Swami > > Larry Young wrote: > Swami, > > When I detect a problem like this in my code, I call "close()" on > the datasource, which in my case is a BasicDataSource. This blows away all > currently held connections in the pool. If you're in a multi-threaded > world like in a web app, you might want to be a bit careful of how you do > this to avoid any race conditions, although if one connection is dead, more > than likely they all will be. > > Another thing that I do is I have an agreement with our AS400 DB > folks that when they are going down, they send me a message so I can handle > this type of behavior a bit more gracefully. > > --- regards --- > Larry > > > At 10:07 AM 12/2/03, you wrote: > >>I need some help on how to refresh DB connection using DBCP. We have a web >>application built on Struts running on Tomcat 4.1.18 and talking to a >>AS400 database. We use commons DBCP for datasoures. >> >>Our database goes down every morning at 5 AM for maintenanace because of >>which Tomcat/DBCP loses its connection. When I come in the morning and >>try to access the app ,I usually get a connection exception because >>datasource.getConnection() craps out. I usually restart Tomcat to refresh >>all connections ( the project is still under development and hence I get >>away with it). >> >>Is there a parameter setting by which I can ask DBCP to see if the >>connection is stale (like in the case of a DB shutdown) and if so release >>all connections or even better try 'n' times to refresh before releasing them? >> >>Intuitively I thought the 'minIdle=0' wud do the trick but it is set to >>zero by default anyway. Will setting removeAbandoned to true help my cause? >> >>TIA. >>Swami --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org