问题
Oracle JDBC driver 11.2.x:
Should I rely on the implicit statement cache or should I invoke setPoolable(true) on each created Statement? What are the differences, advantages and disadvantages of both methods?
回答1:
Statement caching improves performance by caching executable statements that are used repeatedly, such as in a loop or in a method that is called repeatedly.
When you enable implicit Statement caching, JDBC automatically caches the prepared or callable statement when you call the close method of this statement object.
Invoking setPoolable(true) on each created statement caches the statement.
I'd say that you're better off relying on the implicit Statement cache.
Here's Oracle's documentation on Statement and Result Set Caching for Oracle 11.2.
来源:https://stackoverflow.com/questions/4499179/oracle-jdbc-driver-implicit-statement-cache-or-setpoolabletrue