• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you get a OracleCallableStatement compatible object from your con.prepareCall()?
 
nandini lagunia
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
con.prepareCall() returns java.sql.CallableStatement.
 
Jan Cumps
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...
 
reply
    Bookmark Topic Watch Topic
  • New Topic