tags:

views:

99

answers:

2

Perhaps I'm retarded, but I can't figure out how to set MaxPooledStatements in Oracle using the Oracle thin JDBC driver. Could someone point me in the right direction?

A: 

This should work:

Properties p = new Properties();
p.setProperty("user", userid);
p.setProperty("password", password);
p.setProperty("MaxPooledStatements", "200");
// set other properties 
Connection conn = driver.connect(url, p);  // can also use DriverManager but no real benefit
Dan
A: 

I'd suggest you read more about statement pooling with Oracle. For instance here

Although Oracle JDBC drivers are designed with the supposition that implicit caching is enabled, this feature is not turned on by default. To enable implicit caching on the connection, you can set the implicitCachingEnabled property of the corresponding OracleConnection object to true and set the statementCacheSize property to a positive integer. This can be done as follows:

  conn.setImplicitCachingEnabled(true);
  conn.setStatementCacheSize(10);

When using aUCP JDBC connection pool, you can enable statement caching by setting maxStatements property to a positive integer:

  pds.setMaxStatements(10);
Marius Burz