OceanBase Connector/J calls API operations to enable or disable statement caching and set the number of callable statements and the maximum number of SQL statements that can be cached.
The following table describes the parameters.
| Parameter | Description |
|---|---|
| useServerPrepStmts | Specifies whether to execute PrepareStatement on the server before execution. Generally, a direct command (text protocol) is used to activate this option. This parameter is correlated with the rewriteBatchedStatements parameter. If rewriteBatchedStatements is true, this parameter is set to false. The default value is false. |
| cachePrepStmts | Specifies whether to cache the prepared statements. If useServerPrepStmts = true, commands that are composed of the prepared statements are cached in the LRU cache to avoid re-preparing the commands. The next time you execute a prepared statement that is cached in the LRU cache, the prepared identifiers and parameters, if any, will be sent to the server. With this option, the server does not need to re-parse the statement. The default value is true. |
| prepStmtCacheSize | The size of the Prepared Statement cache for cachePrepStmts when useServerPrepStmts = true. The default value is 250. |
| prepStmtCacheSqlLimit | The maximum number of prepared statements that can be cached. If useServerPrepStmts = true, prepared statements beyond this threshold will not be cached. The default value is 2048. |
| cacheCallableStmts | Specifies whether to enable caching Callable Statements. The default value is true. |
| callableStmtCacheSize | The maximum number of callable statements that OceanBase Connector/J can cache for each virtual machine (VM) if cacheCallableStmts is set to true. The default value is 150. |