• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Stored Procedure Problem

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am calling a stored procedure in an oracle database.
It is executing properly but I am getting a problem in getting back the data.

Here is what I have:

CallableStatement cstmt = conn.prepareCall("{? = call device_search.qipep(?)}");
cstmt.registerOutParameter(1,OracleTypes.CURSOR);
cstmt.setString(2,ip_address);
cstmt.execute();

//When it reaches here an ORA-00900: invalid SQL statement is thrown.

ResultSet rs = (ResultSet)cstmt.getObject(1);

I think this problem could because of datatype mismatch.
Is there any other way of retrieving data from stored procedure.

Please help
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to use other getObject(String parameterName, Map map) , providing map value to map from sql type Cursor to java type ResultSet.

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nee,

What is signature of your stored procedure, As I remember for calling Stored Procdure I used to crate CallableStatement like this

CallableStatement cstmt = conn.prepareCall("call device_search.qipep(?,?)");

thanks
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic