FirebirdSQL / jaybird

JDBC driver for Firebird
https://firebirdsql.org/en/jdbc-driver/
GNU Lesser General Public License v2.1
94 stars 23 forks source link

Implement Statement.setPoolable to record the value set #803

Closed mrotteveel closed 7 months ago

mrotteveel commented 7 months ago

Currently, Jaybird does nothing in Statement.setPoolable, and always returns false from Statement.isPoolable, the JDBC API doc of [Statement.setPoolable](https://docs.oracle.com/en/java/javase/21/docs/api/java.sql/java/sql/Statement.html#isPoolable()) says:

Requests that a Statement be pooled or not pooled. The value specified is a hint to the statement pool implementation indicating whether the application wants the statement to be pooled. It is up to the statement pool manager as to whether the hint is used.

The poolable value of a statement is applicable to both internal statement caches implemented by the driver and external statement caches implemented by application servers and other applications.

By default, a Statement is not poolable when created, and a PreparedStatement and CallableStatement are poolable when created.

In short, FBStatement should return false by default, and FBPreparedStatement and FBCallableStatement should return true by default, and the value set should be recorded and returned when requested.

NOTE: This does not mean that Jaybird actually pools statements, this is just about recording the information so that it might get used by a connection pool or statement pool implementation.