Bob, thanks for the reply.

I'm not using BasicDataSource at all, but maybe I should? I dunno. I
am basing my code off of one of the examples. To create my pool:

ObjectPool pool = new GenericObjectPool(null);
ConnectionFactory conFactory =
         new DriverManagerConnectionFactory(uri, dbUsername, dbPassword);
PoolableConnectionFactory factory =
         new PoolableConnectionFactory(connFactory, pool, null, null,
true, false);
Class.forName(driverClassName);
Class.forName("org.apache.commons.dbcp.PoolingDriver");
PoolingDriver driver = (PoolingDriver)
DriverManager.getDriver("jdbc:apache:commons:dbcp:");
driver.registerPool("myPool", pool);

To use a connection:

  public Connection getConn() throws SQLException {
     return DrvierManager.getConnection("jdbc:apache:commons:dbcp:myPool");
  }

To return a connection:

  public void releaseConn(Connection c) throws SQLException {
     c.close();
  }

Perhaps I'm going about this all wrong?

James




On 12/13/06, Bob Arnott <[EMAIL PROTECTED]> wrote:
James A. Cubeta wrote:

[snipped...]

> So my questions revolve around tweaking this framework for speed. I
> guess my very first question is: Is there a way to instruct DBCP to
> initially set up a some number of connections?

When you create your pool with BasicDataSource, you can modify its behavior
with it's properties. One of them is initialSize -

http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/BasicDataSource.html#initialSize

Perhaps this will supply the functionality you are looking for...?

Cheers,

--
Bob Arnott


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
James A. Cubeta
703.624.5689 (c) / 571.223.3368 (w)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to