PreparedStatement Pool with Connection Pool [duplicate]

自作多情 提交于 2019-11-28 10:15:17

问题


Possible Duplicate:
Prepared statement pooling in dbcp

I am building a web application that uses Tomcat's Database connection pooling mechanism for its internal use. I am trying to pool the prepared statements as well so that the application is more efficient in retrieving data.

From what I understand, connections are returned to the pool when the connection, resultset and statements are closed. If appropriate flags are set, abandoned connections are also closed and returned to the pool. Closing a connection means releasing all database cursors and cached statement including prepared statements. So whats the point of prepared statement pooling?


回答1:


A generic answer :)

Connection objects are not really closed but only returned to the pool when you call close() and the prepared statement pooling works on per connection basis and they are cached as long as the connection object remains active.



来源:https://stackoverflow.com/questions/11889401/preparedstatement-pool-with-connection-pool

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