• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Problem in getting multiple resultsets from Oracle Stored Procedure

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi java gurus,
I'm using Websphere 3.5 standard edition with Oracle 8i as backend. I'm trying to access multiple resultsets thru oracle stored procedure.
-----------------------------
PROCEDURE add_Person (
pPersonId IN INTEGER,
pCountry OUT tCursor,
pPerson OUT tCursor) as

BEGIN
OPEN pCountry FOR
SELECT CTRY_CODE,DESC FROM COUNTRY;
OPEN pPerson FOR
SELECT * FROM PERSONS WHERE PERSON_ID = pPersonId;
END;
END;
---------------------
This procedure works well thru Oracle DBA Studio, but when I call it thru my java program,
-------------------------
Callable Statement stmt = connection.prepareCall("{call add_person(?,?,?)}");
stmt.setInt(1, pId);
stmt.registerOutParameter(2,OracleTypes.CURSOR);
stmt.registerOutParameter(3,OracleTypes.CURSOR);
stmt.execute();
ResultSet rs = ((OracleCallableStatement)stmt).getCursor(2);
----------------------
I get a ClassCastException at runtime at last line above.
If any body has ever worked on Websphere+Oracle8i with such kinda stored procedures (returninmg multiple resulsets), pls help me out of this trouble..
Thanks for your time
sandeep
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use ResultSet rs = (ResultSet)stmt.getObject(2);
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic