I'm using JBoss 3.2.3 (Jetty) and have just enable prepared-statement-caching by setting the prepared-statement-cache-size in the datasource descriptor. The setting however appears to have had no effect, and I can see in the debugger that I keep getting a new instance of a prepared statement.
Is there anything else I need to do apart from simply modify the datasource descriptor?
Descriptor snippet below..
<local-tx-datasource>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<jndi-name>Blah</jndi-name>
<connection-url>jdbc:oracle:thin:@server1:1521:server1</connection-url>
<user-name>user</user-name>
pass
<min-pool-size>20</min-pool-size>
<max-pool-size>40</max-pool-size>
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
<idle-timeout-minutes>5</idle-timeout-minutes>
<prepared-statement-cache-size>50</prepared-statement-cache-size>
</local-tx-datasource>
Found answer, if you call prepareStatement with any arguments other than just the sql then caching doesn't work.