java.sql.SQLException: Protocol violation

Got this error closing a Statement object - what does this error below mean??

java.sql.SQLException:  Protocol violation
   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
   at oracle.jdbc.dbaccess.DBError.check_error(DBError.java)
   at oracle.jdbc.ttc7.Oclose.receive(Oclose.java)
   at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java)
   at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java)
booksplusAsked:
Who is Participating?
 
Helena Markováprogrammer-analystCommented:
If you are using JDBC Thin then this Metalink note can help - Note:66677.1:

When trying to run a JDBC Thin application, it is getting the error:

java.sql.sqlexception Protocol Violation.

Problem Explanation
-------------------

In most cases, this error is a symptom of a bug.

Below are some of the known bugs that give this error message:

<[BUG:655102]> - caused by attempting to fetch from a column declared as CHAR(254) - fixed in JDBC 8.0.6 (OCI and Thin)

<[BUG:1069768]> - cuased by attempting to receive a struct into a resultset - fixed in JDBC 8.1.7 (OCI) and JDBC 8.1.6(Thin)

<[BUG:1139204]> - caused by binding more then 250 parameters to a statement - fixed in JDBC 8.1.7 (OCI) and JDBC 8.1.6 (Thin)

Below are some other situations that have been known to cause this error:

- When the user password has expired, due to bug:1668134.

- When the JDK versions are not in sync with the proper driver file (classes111.zip, classes12.zip, ojdbc14.jar).

- When the version of the drivers are older than the version of the server.

Problem Solution
----------------

In most cases, this error is a symptom of a bug. The causes of each bug are always unique. A test case will need to be generated by the customer to illustrate how to reproduce the problem.

If the cause is known, you would apply the particular Oracle patch.

Always, upgrade the JDBC Driver to the latest version available and see if the problem reproduces before contacting Oracle Support.

Note, if you are using the JDBC OCI driver, the entire Oracle client would need to be upgraded to the latest version.

References
----------

<[BUG:618721]> java.sql.sqlexception: Protocol Violation on Selecting Large (Amount of) Data
<[BUG:602357]> Protocol Violation Error After Several Operations
<[BUG:1139204]> Protocol Violation if More (Than) 250 Parameters in Callable Statement
<[BUG:655102]> CHAR(254) Datatype Results in Protocol Violation
<[BUG:1069768]> Thin Driver Gives Protocol Violation While Receiving Struct
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.