Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 19306 invoked from network); 3 Dec 2003 17:41:06 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 3 Dec 2003 17:41:06 -0000 Received: (qmail 7661 invoked by uid 500); 3 Dec 2003 17:40:40 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 7649 invoked by uid 500); 3 Dec 2003 17:40:40 -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 7635 invoked from network); 3 Dec 2003 17:40:40 -0000 Received: from unknown (HELO mail03.gmu.edu) (129.174.0.113) by daedalus.apache.org with SMTP; 3 Dec 2003 17:40:40 -0000 Received: from booz510018 ([156.80.87.146]) by mserver3.gmu.edu (iPlanet Messaging Server 5.2 Patch 1 (built Aug 19 2002)) with ESMTPA id <0HPB00M6AYFK93@mserver3.gmu.edu> for commons-user@jakarta.apache.org; Wed, 03 Dec 2003 12:40:33 -0500 (EST) Date: Wed, 03 Dec 2003 12:40:32 -0500 From: Arun Natarajan Subject: DBCP oracle connections less than minActive ? In-reply-to: <1070461629.18699.8.camel@munich> To: Jakarta Commons Users List Message-id: MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal 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 Hi, I am using DBCP for a web application. I have a class that initializes the connection parameters(min/max values for idle/active) and also provides a getConnection() method. In getConnection() I have debug statements that print the numActive & maxActive connections and also the numIdle & maxIdle connection values. I have a test method that requests for 15 connections in a loop and executes a simple qry; i am not closing any of the connections. At the end of the loop this is the debug message: getNumActive/getMaxActive 15/20 getNumIdle/getMaxIdle0/20. The parameters I had set are: connectionPool.setMaxActive(20); connectionPool.setMinIdle(5); connectionPool.setMaxIdle(20); When i look at the connections in oracle, I see only 4 connections from the java user. Should I not be seeing the 15 active connections? Am i missing some other parameters ? Thanks in advance for any help. Arun N Here's the output ***************** Database Drivers were loaded successfuly Creating conn pool, max:20 min:5 Data source inited successfuly Starting to get connections Requesting connection0 at 1070472656437 getNumActive/getMaxActive0/20 getNumIdle/getMaxIdle5/20 Status after returning a connection getNumActive/getMaxActive1/20 getNumIdle/getMaxIdle4/20 Obtained connection0 at 1070472656500 Requesting connection1 at 1070472656515 getNumActive/getMaxActive1/20 getNumIdle/getMaxIdle4/20 Status after returning a connection getNumActive/getMaxActive2/20 getNumIdle/getMaxIdle3/20 Obtained connection1 at 1070472656515 Requesting connection2 at 1070472656531 getNumActive/getMaxActive2/20 getNumIdle/getMaxIdle3/20 Status after returning a connection getNumActive/getMaxActive3/20 getNumIdle/getMaxIdle2/20 Obtained connection2 at 1070472656531 Requesting connection3 at 1070472656531 getNumActive/getMaxActive3/20 getNumIdle/getMaxIdle2/20 Status after returning a connection getNumActive/getMaxActive4/20 getNumIdle/getMaxIdle1/20 Obtained connection3 at 1070472656546 Requesting connection4 at 1070472656546 getNumActive/getMaxActive4/20 getNumIdle/getMaxIdle1/20 Status after returning a connection getNumActive/getMaxActive5/20 getNumIdle/getMaxIdle0/20 Obtained connection4 at 1070472656562 Requesting connection5 at 1070472656562 getNumActive/getMaxActive5/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive6/20 getNumIdle/getMaxIdle0/20 Obtained connection5 at 1070472656625 Requesting connection6 at 1070472656625 getNumActive/getMaxActive6/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive7/20 getNumIdle/getMaxIdle0/20 Obtained connection6 at 1070472656687 Requesting connection7 at 1070472656687 getNumActive/getMaxActive7/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive8/20 getNumIdle/getMaxIdle0/20 Obtained connection7 at 1070472656765 Requesting connection8 at 1070472656765 getNumActive/getMaxActive8/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive9/20 getNumIdle/getMaxIdle0/20 Obtained connection8 at 1070472656843 Requesting connection9 at 1070472656843 getNumActive/getMaxActive9/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive10/20 getNumIdle/getMaxIdle0/20 Obtained connection9 at 1070472656921 Requesting connection10 at 1070472656921 getNumActive/getMaxActive10/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive11/20 getNumIdle/getMaxIdle0/20 Obtained connection10 at 1070472656984 Requesting connection11 at 1070472656984 getNumActive/getMaxActive11/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive12/20 getNumIdle/getMaxIdle0/20 Obtained connection11 at 1070472657046 Requesting connection12 at 1070472657046 getNumActive/getMaxActive12/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive13/20 getNumIdle/getMaxIdle0/20 Obtained connection12 at 1070472657109 Requesting connection13 at 1070472657109 getNumActive/getMaxActive13/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive14/20 getNumIdle/getMaxIdle0/20 Obtained connection13 at 1070472657234 Requesting connection14 at 1070472657234 getNumActive/getMaxActive14/20 getNumIdle/getMaxIdle0/20 Status after returning a connection getNumActive/getMaxActive15/20 getNumIdle/getMaxIdle0/20 Obtained connection14 at 1070472657312 Out of loop Here's the code that initializes the pool ****************************************** //Load the Drivers. try { Class.forName(driver).newInstance(); System.out.println("Database Drivers were loaded successfuly"); } catch (Exception e) { System.out.println("Database Drivers could not be loaded: Class for name failed" + e); } //Set conn pool parameters. System.out.println("Creating conn pool, max:" + maxConn + " min:" + minConn); connectionPool = new GenericObjectPool(null); connectionPool.setMaxActive(maxConn);//5 connectionPool.setMinIdle(minConn);//20 connectionPool.setMaxIdle(maxConn);//20 ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(URL,null); PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory (connectionFactory,connectionPool,null,null,false,true); ds = new PoolingDataSource(connectionPool); try { //Just making sure the min Connections are created on startup for(int i=0; i