Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 88713 invoked from network); 10 Dec 2002 19:35:52 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 10 Dec 2002 19:35:52 -0000 Received: (qmail 3438 invoked by uid 97); 10 Dec 2002 19:36:41 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 3420 invoked by uid 97); 10 Dec 2002 19:36:41 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 3405 invoked by uid 98); 10 Dec 2002 19:36:40 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: Tue, 10 Dec 2002 14:33:46 -0500 From: Joaquim Subject: Re: removeAbandoned does not work To: Tomcat Users List Message-id: <3DF6419A.8040604@comcast.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 References: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Are you getting any exception? The close statements are in the try catch block, if you get an exception, they not be executed. I would put the close statements in a finally statement, to ensure that they would be executed. Kranthi Yemula wrote: >Hi, > >I am using tomcat 4.0.3. I am playing with Datasources. >I am having trouble validating 'removing abandoned database pool >connections'. > >I did the below: >----------------------------------------------- >1) I have set up the below parameters in my server.xml > > > >removeAbandoned >true > > > >removeAbandonedTimeout >20 > > > >logAbandoned >true > > >----------------------------------------------- > >2) I modified my test program so that it does not close databse connection. > > >package foo; > >import javax.naming.*; >import javax.sql.*; >import java.sql.*; > >public class DBTest { > > String foo = "Not Connected"; > int bar = -1; > > public void init() { > try{ > Context ctx = new InitialContext(); > if(ctx == null ) > throw new Exception("Boom - No Context"); > > Context envCtx = (Context) ctx.lookup("java:comp/env"); > > // Look up our data source > DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Kranthi"); > > > if (ds != null) { > Connection conn = ds.getConnection(); > > if(conn != null) { > foo = "Got Connection "+conn.toString(); > Statement stmt = conn.createStatement(); > ResultSet rst = > stmt.executeQuery( > "select id, foo, bar from testdata"); > if(rst.next()) { > foo=rst.getString(2); > bar=rst.getInt(3); > } > /*stmt.close(); > rst.close(); > conn.close(); > */ > } > } > }catch(Exception e) { > e.printStackTrace(); > } > } > >---------------------------------------------------------------------------- >-------------- > >I call the jsp that calls the above java program. But, its not actually >closing the open connections. > >Can anybody please help me. > >Thanks, >KYemula. > > > > -- Joaquim Laureano Lusostar Technologies, LLC Phone: 732-542-4890 Email: laureano8@comcast.net -- To unsubscribe, e-mail: For additional commands, e-mail: