Oracle jdbc driver: implicit statement cache or setPoolable(true)?

女生的网名这么多〃 提交于 2019-12-10 19:49:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!