A java.lang.ClassCastException Occurs When an OracleCallableStatement Is Used with the Universal Connection Pool (UCP)

(Doc ID 759103.1)

Last updated on AUGUST 16, 2016

Applies to:

JDBC - Version 10.2.0 to
Information in this document applies to any platform.


A simple application that uses the Universal Connection Pool (UCP) and an OracleCallableStatement to call a simple PL/SQL procedure fails with a java.lang.ClassCastException.

The simple PL/SQL procedure is:

create or replace procedure NoTypesDoNothing is

The java application is:

import java.sql.*;
import oracle.ucp.jdbc.PoolDataSourceFactory;
import oracle.ucp.jdbc.PoolDataSource;
import oracle.jdbc.driver.OracleCallableStatement;

public class NoTypesX
  public static void main (String[] args) 
      PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
      Connection conn = pds.getConnection(); 

      String query = "{call NoTypesDoNothing}";
      OracleCallableStatement ocs = (OracleCallableStatement)conn.prepareCall(query);
    catch (Exception e) 

The test resulting in the exception is:

D:\TestJdbc>set PATH=C:\Program Files\Java\jdk1.5.0_17\bin

D:\TestJdbc>set CLASSPATH=.;d:\JdbcDrivers\\lib\ojdbc14.jar;d:\UCP\ucp.jar

D:\TestJdbc>javac NoTypesX.java

D:\TestJdbc>java NoTypesX
java.lang.ClassCastException: oracle.jdbc.driver.$Proxy1
        at NoTypesX.main(NoTypesX.java:20)


Sometimes it can happen that following error is reported instead:

java.lang.ClassCastException: oracle_jdbc_driver_T4CCallableStatement_Proxy


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