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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
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: 2503
    
    8

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


OCUP UML fundamental and ITIL foundation
youtube channel
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: 2503
    
    8

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://aspose.com/file-tools
 
subject: issue typecasting java.sql.CallableStatement into oracle.jdbc.driver.OracleCallableStatement