Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PreparedStatement caching in Tomcat

I am looking for a way to achieve PreparedStatement caching, so as to save recreating the PreparedStatement objects for queries that were already executed in the past.

Is there some built in way to achieve this using Tomcat? Or must I program this cache myself?

like image 897
nivcaner Avatar asked Jun 03 '09 13:06

nivcaner


2 Answers

I believe tomcat uses commons-dbcp and commons-dbcp supports prepared statement pooling.

check it out here.

poolPreparedStatements false Enable prepared statement pooling for this pool.

like image 59
ScArcher2 Avatar answered Sep 30 '22 02:09

ScArcher2


Prepared statement caching is done by either your JDBC connection pool or your JDBC driver, not by Tomcat.

like image 29
Robert Munteanu Avatar answered Sep 30 '22 02:09

Robert Munteanu