Statement caching improves performance by caching repeatedly used executable statements, such as statements in loops or in repeatedly called methods.
The JDBC standard defines a statement caching interface.
Statement caching can achieve the following effects:
Save the overheads for repeatedly creating cursors.
Prevent repeated statement parsing and creation.
Reuse data structures in clients
Explicit statement caching can cache and retrieve specified statements that are prepared and callable. Explicit statement caching is dependent on the key, which is a Java String provided. Note
Normal statements cannot be cached.
Explicit statement caching retains the statement data, status, and metadata, thus providing high performance. During explicit statement caching, if the JDBC driver fails to find a matching statement in the cache, it returns null.