aspose file tools
The moose likes JDBC and the fly likes issue typecasting java.sql.CallableStatement into oracle.jdbc.driver.OracleCallableStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "issue typecasting java.sql.CallableStatement into oracle.jdbc.driver.OracleCallableStatement" Watch "issue typecasting java.sql.CallableStatement into oracle.jdbc.driver.OracleCallableStatement" New topic
Author

issue typecasting java.sql.CallableStatement into oracle.jdbc.driver.OracleCallableStatement

nandini lagunia
Ranch Hand

Joined: May 05, 2009
Posts: 57
Hi,

I have written a test class in which I've typecasted java.sql.CallableStatement into oracle.jdbc.driver.OracleCallableStatement and it's works fine.
the code is:-


When I put the code in an ejb business method and invoke the method, it throws java.lang.ClassCastException at line #456

I don't have any clue why it's behaving like this. Will anybody help me???

Thanks in advance.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

Do you get a OracleCallableStatement compatible object from your con.prepareCall()?


OCUP UML fundamental
ITIL foundation
nandini lagunia
Ranch Hand

Joined: May 05, 2009
Posts: 57
Hi,

The same piece of code works fine in the standalone utilty.

OracleCallableStatement interface implements java.sql.CallableStatement()here so we can very well
go for explicit casting.

Don't you think so?
nandini lagunia
Ranch Hand

Joined: May 05, 2009
Posts: 57
con.prepareCall() returns java.sql.CallableStatement.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

nandini lagunia wrote:con.prepareCall() returns java.sql.CallableStatement.
Do you know the exact class that it returns in your case,
both for the standalone and not so standalone use case?

you can use the getName() method on cs in both cases. Wonder if there is a difference in the two cases...
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: issue typecasting java.sql.CallableStatement into oracle.jdbc.driver.OracleCallableStatement
 
Similar Threads
Parameter Type Conflict: sqlType=2003
Size limit on OracleCallableStatement setARRAY ?
Class Cast exception in oracle.sql.ArrayDescriptor
Need help with callableStatement()
Size limit in OracleCallableStatement setARRAY