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?
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.