aspose file tools*
The moose likes JDBC and the fly likes java.lang.ClassCastException: $Proxy0 cannot be cast to oracle.jdbc.OracleConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.lang.ClassCastException: $Proxy0 cannot be cast to oracle.jdbc.OracleConnection" Watch "java.lang.ClassCastException: $Proxy0 cannot be cast to oracle.jdbc.OracleConnection" New topic
Author

java.lang.ClassCastException: $Proxy0 cannot be cast to oracle.jdbc.OracleConnection

Manju Krishna
Ranch Hand

Joined: Apr 09, 2009
Posts: 48
    
    1
I am trying to call a stored proc having table type IN and OUT parameter using jdbc.

When I tried as a standalone program I am not having any issues. Once I deployed the code in Tomcat, the below esxception is thrown

java.lang.ClassCastException: $Proxy0 cannot be cast to oracle.jdbc.OracleConnection
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:160)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:128)


on executing this line of code,



Upon analysis I found that the connection object I get here is of type,oracle.jdbc.driver.T4CConnection. But as per the code it expects a oracle.jdbc.OracleConnection.
I tried adding the ojdbc6.jar in tomcat/lib/common folder as suggested in few forums but did not help.

Please suggest a feasible solution.
 
 
subject: java.lang.ClassCastException: $Proxy0 cannot be cast to oracle.jdbc.OracleConnection
 
Similar Threads
classcast exception for creating Arraydescriptor only for websphere
classcast exception only with websphere server not for weblogic
classcast exception while creating array descriptor for oracle
Apache Commons DBCP connection object problem
ArrayDescriptor - SqlException