Great! thanks, i used the second appraoch. Regards, Arun N
-----Original Message----- From: Dirk Verbeeck [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 3:14 PM To: Jakarta Commons Users List Subject: Re: DBCP PoolingDataSource example You can setMinIdle() to always have a minium amount of idle connection in the pool. (not only at the start of the pool but the whole time) The minIdle check is done in the evictor thread so timeBetweenEvictionRunsMillis has to be set to a non negative-value. (you can optionally turn off the eviction by setting numTestsPerEvictionRun to zero or just set minEvictableIdleTimeMillis very high). A more simple way to create a number of connections at startup is to use the pool.addObject() method. (add the following after creating the PoolableConnectionFactory) for (int i=0 ; i<initialsize ; i++) { connectionPool.addObject() } -- Dirk Natarajan Arun wrote: > Hi All, > When using DBCP what parameter needs to be set on the ObjectPool so that a > minimum number of connections are created when the pool instance is created > ?? I thought the setMinIdle() does this, but doesn't look so. > > The code I use: > > try { > Class.forName(driver).newInstance(); > System.out.println("No Errors occured 1"); > } catch (Exception e) { > System.out.println("class for name failed" + e); > } > connectionPool = new GenericObjectPool(null); > connectionPool.setMaxActive(maxConn); > connectionPool.setMinIdle(minConn); > > //connectionPool.setWhenExhaustedAction(connectionPool.WHEN_EXHAUSTED_GROW); > -- NEED TO TEST THIS!!! > ConnectionFactory connectionFactory = new > DriverManagerConnectionFactory(URL,null); > PoolableConnectionFactory poolableConnectionFactory = new > PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,t > rue); > ds = new PoolingDataSource(connectionPool); > System.out.println("Data source inited successfuly"); > > Thanks, > Arun N > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
