• 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:

Not able to read ResultSet from as400 stored procedure

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My stored procedure on AS400 returns a result set to the caller. The 'execute' is successful. (returns true)
But, when I read the result set, there are no records. Please see sample code below:

CallableStatement sqlCall = connection.prepareCall("CALL PROC1(?,?,?)");

// Run an SQL SELECT statement

sqlCall.setInt(1, 1) ;
sqlCall.setInt(2, 5) ;

sqlCall.registerOutParameter(3, java.sql.Types.INTEGER);
System.out.println ("Calling the as400 procedure...");

boolean b = sqlCall.execute();

if(b){
ResultSet rs = sqlCall.getResultSet();

System.out.println ("Retrieving the out parms...");
int total = sqlCall.getInt(3);

while(rs.next())
{
// do something here...
}

} //end if

The value of 'b' is true. getResultSets() also is not null. (Returns a id=CSRS0001 while doing println(rs) )
I am breaking my head over why I am not able to read any records? Any help is appreacited.



 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"SideWinder Bullock", please check your private messages for an important administrative matter.
 
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A ResultSet with zero records is a perfectly normal thing to encounter.
 
Srinivasan Varadharajan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the stored procedure returns a result set. I am sure the query (in the procedure) returns about 800 records...
reply
    Bookmark Topic Watch Topic
  • New Topic