MaxPooledStatements setting in JDBC oracle
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?
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
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);
精彩评论