I have just upgraded Spring/SpringBoot dependencies and noticed that class JdbcTemplate does not have property "nativeJdbcExtractor" any more.
I was able to find the details and background: https://jira.spring.io/browse/SPR-14670
However I was not able to find the replacement configuration. I use commons-dbcp library and Spring classes like SimpleJdbcCall etc. I never deal with low level JDBC API, however if the vendor code needs its real Connection type (Oracle) the nativeJdbcExtractor settings ensured it will get it somewhere deep in Spring JDBC code (not my app. code). I´m not sure how I can address this by calling connection.unwrap() if I need Spring API to handle this automatically as it did it in past.
java.lang.ClassCastException: org.apache.commons.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
Is that hidden somewhere in DataSource configuration? I have upgraded from commons-dbcp 1.4 to commons-dbcp2 but cannot find anything useful so far (BasicDataSource).
Update: Following thread is relevant but I cannot digest the answer I´m looking for since the Connection object is obtained within JdbcTemplate class and thus out of my control.
replacement for jdbc.support.nativejdbc remove in Spring 5
Update #2 - Stack Trace
Caused by: java.lang.ClassCastException: org.apache.commons.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
at oracle.sql.TypeDescriptor.setPhysicalConnectionOf(TypeDescriptor.java:832)
at oracle.sql.TypeDescriptor.<init>(TypeDescriptor.java:586)
at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:224)
at org.springframework.data.jdbc.support.oracle.SqlArrayValue.createTypeValue(SqlArrayValue.java:90)
at org.springframework.jdbc.core.support.AbstractSqlTypeValue.setTypeValue(AbstractSqlTypeValue.java:60)
at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:293)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:232)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:147)
at org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:200)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1048)
at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1104)
at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:414)
at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:397)
at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:193)
Update #3 - the code doing the cast (Oracle JDBC)
public void setPhysicalConnectionOf(Connection var1) {
this.connection = ((oracle.jdbc.OracleConnection)var1).physicalConnectionWithin();
}