Description
Tom Jahncke opened SPR-14574 and commented
In the StatementCreatorUtils class, setNull method, the call to ps.getParameterMetaData().getParameterType(paramIndex), happens for every null parameter.
If the database is not local to where the Java application is running the overhead of this repeated statement is a significant performance hit due to the latency overhead of each DB operation. For example, we are performing a batch insert from a remote site back to the main enterprise system of thousands of records each with several nulls.
Not sure how feasible it is, but could you cache the sql type for a prepared statement / parameter index so once it is determine it does not have to be derive again?
Thanks!!
Affects: 4.2.5
Issue Links:
- performancedrop due to repeated JDBC 3.0 getParameterType calls in setNull in StatementCreatorUtils [SPR-11100] #15726 performancedrop due to repeated JDBC 3.0 getParameterType calls in setNull in StatementCreatorUtils
- Oracle 12c JDBC driver throws inconsistent exception from getParameterType (affecting setNull calls) [SPR-13825] #18398 Oracle 12c JDBC driver throws inconsistent exception from getParameterType (affecting setNull calls)
- Protect against getParameterType cursor leak with Oracle 12c JDBC driver [SPR-14629] #19196 Protect against getParameterType cursor leak with Oracle 12c JDBC driver
Backported to: 4.2.8