Projects | Downloads | Tickets | KnowledgeBase | Forums | About | Search
Load:0.03 0.02 0.00
Sessions: 18
Login
User:
Pass:
Remember login:
New User | Lost Password

Case[1146]: Oracle JDBC: SQLException "missing in or out parameter at index" with clearParameters

Printable View
Case
Title:Oracle JDBC: SQLException "missing in or out parameter at index" with clearParameters
Number:1146
Created:12/01/2008 17:16
Created By:bemowski
Page Views:1869
Status: ACTIVE
Approver:unassigned
Keywords:oracle preparedstatement in out clearparameters 10.2.0.1
Related Tickets:
Detail

I was caching an Oracle PreparedStatement locally in a class that needed performance. On (infrequent) insert, I would call clearParameters(), then set the variables, then executeUpdate would throw:
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 3
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
        at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1681)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3280)
        at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
        at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
...


It was not easy, but I found this:

5658207 SQLException "missing in or out parameter at index" with clearParameters

here

Looks like a bug in the driver. So I went to see what driver I was using. It is not obvious from the filename, but I found this in the manifest:
Manifest-Version: 1.0
Specification-Title:    Oracle JDBC driver classes for use with JDK14
Sealed: true
Created-By: 1.4.2_08 (Sun Microsystems Inc.)
Implementation-Title:   ojdbc14.jar
Specification-Vendor:   Oracle Corporation
Specification-Version:  Oracle JDBC Driver version - "10.2.0.1.0XE"
Implementation-Version: Oracle JDBC Driver version - "10.2.0.1.0XE"
Implementation-Vendor:  Oracle Corporation
Implementation-Time:    Wed Jan 25 01:28:31 2006

Name: oracle/sql/converter/
Sealed: false

Name: oracle/sql/
Sealed: false

Name: oracle/sql/converter_xcharset/
Sealed: false


bingo... ok, I updated the driver. Now, I see:
Manifest-Version: 1.0
Specification-Title:    Oracle JDBC driver classes for use with JDK14
Sealed: true
Created-By: 1.4.2_14 (Sun Microsystems Inc.)
Implementation-Title:   ojdbc14.jar
Specification-Vendor:   Oracle Corporation
Specification-Version:  Oracle JDBC Driver version - "10.2.0.4.0"
Implementation-Version: Oracle JDBC Driver version - "10.2.0.4.0"
Implementation-Vendor:  Oracle Corporation
Implementation-Time:    Sat Feb  2 11:40:29 2008

Name: oracle/sql/converter/
Sealed: false

Name: oracle/sql/
Sealed: false

Name: oracle/sql/converter_xcharset/
Sealed: false


And the application works. It appears that there is a bug in clearParameters() in the oracle jdbc driver upto and including 10.2.0.3.


Add Comment


Show System Notes
Copyright 2003-2007, JMatrix International