commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harri Tuomela <ha...@jethro.dyndns.org>
Subject DBCP with PostgreSQL 7.2
Date Thu, 11 Mar 2004 17:55:42 GMT
Hi!

I'm trying to use the Jakarta Commons DBCP package with Tomcat 4.0 and
PostgreSQL 7.2.1. I've set the following parameters for GenericObjectPool:

	dbcp_max_active                        = 10
	dbcp_when_exhausted_action             = 1
	dbcp_max_wait                          = 2000
	dbcp_max_idle                          = 4
	dbcp_test_on_borrow                    = false
	dbcp_test_on_return                    = false
	dbcp_time_between_eviction_runs_millis = 10000
	dbcp_num_tests_per_eviction_run        = 5
	dbcp_min_evictable_idle_time_millis    = 5000
	dbcp_tests_while_idle                  = true

and created an instance of PoolingDriver like this:

	    DriverManagerConnectionFactory connectionFactory =
		new DriverManagerConnectionFactory(jdbcURL,
						   dbUser,
						   dbPassword);
	    PoolableConnectionFactory poolableConnectionFactory =
		new PoolableConnectionFactory(connectionFactory,
					      genericObjectPool,
					      null,
					      "SELECT COUNT(1) FROM pg_database",
					      false,
					      true);
	    PoolingDriver driver = new PoolingDriver();
	    driver.registerPool(poolName, genericObjectPool);

	    Connection pooledConnection = 
		DriverManager.getConnection("jdbc:apache:commons:dbcp:" +
					    poolName);

When I run this code multiple times, it allways creates a new db
connection and the number of idle connections exceeds the allowed limit
(4).

Have I missed something?

Wbr,

    Harri Tuomela

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message