Description
Tom Jahncke opened SPR-13825 and commented
This relates to: #15726
Using the oracle driver (ojdbc7 version 12.1.0.2.0) I ran across the following issue (I opened a support case with Oracle on the root cause of the issue. SR 3-11927085951)
Normally the Oracle driver works fine with following code:
sqlTypeToUse = ps.getParameterMetaData().getParameterType(paramIndex); (from setNull in StatementCreatorUtils line 262)
However, it is possible for a statement to cause Oracle to throw an exception than then all statements going forward no longer use the JDBC 3.0 features to resolve the sql data type for null values.
I understand why driversWithNoSupportForGetParameterType exists and how it helps performance. However, since it is black or white once an exception is thrown the setNull never tries to use the JDBC 3.0 features again (until the app is restarted).
I can think of a few hackish ways to address this, but I am hoping you can come with a solid solution that is solid (My hackish ideas are along the lines or allowing a driver name to be injected that doesn't get added to the global set of drivers not supported.)
FYI, just by having an insert statement with a qualified table name causes the following exception with the oracle JDBC driver. (Without qualification no exception.):
java.sql.SQLFeatureNotSupportedException: Unsupported feature
at oracle.jdbc.driver.OracleParameterMetaData.checkValidIndex(OracleParameterMetaData.java:176)
at oracle.jdbc.driver.OracleParameterMetaData.getParameterType(OracleParameterMetaData.java:327)
at org.springframework.jdbc.core.StatementCreatorUtils.setNull(StatementCreatorUtils.java:262)
Affects: 4.2.4
Attachments:
- Oralce-JDBC-Bug 22983939.pdf (186.38 kB)
Issue Links:
- PreparedStatement#getParameterMetaData() calls may trigger unwanted side effects [SPR-11386] #16013 PreparedStatement#getParameterMetaData() calls may trigger unwanted side effects
- Regression in handling of String passed as Types.OTHER to JdbcTemplate [SPR-12890] #17488 Regression in handling of String passed as Types.OTHER to JdbcTemplate
- 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
- INSERT SELECT of large CLOB causes ORA-01461 on setString [SPR-12240] #16854 INSERT SELECT of large CLOB causes ORA-01461 on setString
- Java boolean is not handled correctly when used with Oracle JDBC driver [SPR-14116] #18688 Java boolean is not handled correctly when used with Oracle JDBC driver
- Regression: Insert statement fails with inconsistent datatypes on Oracle 12c driver [SPR-14191] #18764 Regression: Insert statement fails with inconsistent datatypes on Oracle 12c driver
- Avoid repeated getParameterType calls for setNull with Oracle 12c driver [SPR-14574] #19143 Avoid repeated getParameterType calls for setNull with Oracle 12c driver
- Protect against getParameterType cursor leak with Oracle 12c JDBC driver [SPR-14629] #19196 Protect against getParameterType cursor leak with Oracle 12c JDBC driver
Referenced from: commits e48ec4f, e1bdf55
0 votes, 6 watchers