This blog is mainly about Java...

Friday, February 24, 2017

java.sql.SQLException: Protocol Violation [14, 62]

Apparently there is a bug in OJDBC 7 Oracle Driver version
Take a look at

The stacktrace in question is this:
Caused by: java.sql.SQLException: Protocol Violation [ 14, 62, ]
 at oracle.jdbc.driver.T4CTTIfun.receive( ~[ojdbc7-!/:]
 at oracle.jdbc.driver.T4CTTIfun.doRPC( ~[ojdbc7-!/:]
 at ~[ojdbc7-!/:]
 at oracle.jdbc.driver.T4CConnection.getChars( ~[ojdbc7-!/:]
 at oracle.sql.CLOB.getChars( ~[ojdbc7-!/:]
 at oracle.sql.CLOB.getSubString( ~[ojdbc7-!/:]
 at oracle.jdbc.driver.ClobAccessor.getString( ~[ojdbc7-!/:]
 at oracle.jdbc.driver.GeneratedStatement.getString( ~[ojdbc7-!/:]
 at oracle.jdbc.driver.GeneratedScrollableResultSet.getString( ~[ojdbc7-!/:]
 at ~[spring-jdbc-4.3.5.RELEASE.jar!/:4.3.5.RELEASE]
 at$run$0( [classes!/:0.3]
 at$$Lambda$7.328FAEA0.mapRow(Unknown Source) ~[na:na]
 at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData( ~[spring-jdbc-4.3.5.RELEASE.jar!/:4.3.5.RELEASE]
 at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData( ~[spring-jdbc-4.3.5.RELEASE.jar!/:4.3.5.RELEASE]
 at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement( ~[spring-jdbc-4.3.5.RELEASE.jar!/:4.3.5.RELEASE]
 at org.springframework.jdbc.core.JdbcTemplate.execute( ~[spring-jdbc-4.3.5.RELEASE.jar!/:4.3.5.RELEASE]
 ... 20 common frames omitted

There are 3 actions that can be taken to avoid this bug:

  1. Use the JDBC driver version which seems to fix this bug
  2. Install the patch provided in the Oracle support page. (this is only available to customers with a valid Oracle support license). Download and apply Patch 17976703 from Support Portal -> Patches & Updates Section.
  3. Switch back to the OJDBC 6 driver which doesn't have this bug.