• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to Execute Stored Procedure?

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have following SP
Create Procedure SP_Get_Status
(
@Status varchar(40) OUTPUT
)
as
Begin
Select @Status=Status from Status
End
----------------------------------------------
My Java Code is like THis
con=DriverManager.getConnection(url,"sa","");
CallableStatement cs=con.prepareCall("{call SP_Get_Status(?)}");
cs.registerOutParameter(1, java.sql.Types.VARCHAR);
cs.executeQuery();
-------------------------
Question 1.I get exception:
No ResultSet was produced
Where as this runs fine
Question 2:How to get a reslutset OBject out of this?
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try:
ResultSet rs;
rs = cs.getResultSet();
while(rs.next()){
//do whatever you want to on the result set
}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic