"Parameter Type Conflict" SQLException After Migrating From 9i To 10g JDBC Driver (Doc ID 468327.1)

Last updated on AUGUST 03, 2016

Applies to:

JDBC - Version 11.1.0.6 and later
Information in this document applies to any platform.
This problem can occur on any platform.

Symptoms

A Java program  invokes a  PL/SQL stored procedure having an input/output parameter.

Using the 10g//11g  JDBC driver, it gives the following exception when invoking this procedure:

      "SQLException: Parameter Type Conflict".

This  Exception  is thrown when calling the execute() method of the CallableStatement  object.
The related Java program is the following :

public static void main(String[] args) throws Exception {
  DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  Connection con = DriverManager.getConnection(CON_URL, CON_USR, CON_PAS);
  CallableStatement call = con.prepareCall("{call TEST_ICAM(?,?)}");
  call.setString(1,"20/10/2007");
  call.setDate(2, new java.sql.Date(System.currentTimeMillis())); 
  call.registerOutParameter(2, java.sql.Types.VARCHAR);            
  call.execute();
  String date = call.getString(2);
  System.out.println("" + date);
}

And, the invoked PL/SQL  stored procedure (test2 being the input/output parameter ) has the following code :


CREATE OR REPLACE PROCEDURE TEST_ICAM(test1 IN VARCHAR2,test2 IN OUT VARCHAR2) IS 
BEGIN 
test2:=test1 
END; 

Changes

The JDBC driver  has been upgraded from 9i to 10g. 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms