Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1278135bd9540e7f-bfc8c185-467046b3-bd6a9d1f-f2298e33bd4b33fbbd3c0ffe"><ac:plain-text-body><![CDATA[

http://jakarta.apache.org/commons/dbcp/images/dbcp-logo-white.png

[http://jakarta.apache.org/commons/dbcp/ Commons-DBCP] provides database connection pooling services.[BR]A lot of information is available on the [http://jakarta.apache.org/commons/dbcp/ DBCP website]. If you don't find the information you need you can always contact us using one of the [http://jakarta.apache.org/site/mail2.html#Commons mailing lists].

]]></ac:plain-text-body></ac:structured-macro>

...

Q: <nowiki>Does the current 1.1 release support the poolable/caching of PreparedStatements. I noted that the PoolableConnectionFactory can take a KeyedObjectPoolFactory as a statement pool factory. But there is not concrete implementation for the KeyedPoolableObjectFactory which is required when creating a GenericKeyedObjectPoolFactory. If I pass in a null as shown in the examples, does it cache prepared statements or should I do that in local objects?</nowiki>

A: ??
Yes, prepared statements are being cached. Here is a an example how to use the statement pool:

No Format

ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
    url, username, password);

GenericObjectPool connectionPool = new GenericObjectPool();

// null can used as parameter because this parameter is set in 
// PoolableConnectionFactory when creating a new PoolableConnection
KeyedObjectPoolFactory statementPool = new GenericKeyedObjectPoolFactory(null);

final boolean defaultReadOnly = false;
final boolean defaultAutoCommit = false;
final String validationQuery = null;
new PoolableConnectionFactory(connectionFactory, connectionPool, statementPool,
      validationQuery, defaultReadOnly, defaultAutoCommit);

...

Q: Where do I get a concrete example of PerUserPoolDataSource? How do we use it in a situation where multiple pools are required for different modules of a project and their properties differ on the database transactional load?

...