File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassCastException: $Proxy0 cannot be cast to oracle.jdbc.OracleConnection