• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to read ResultSet from as400 stored procedure

 
Srinivasan Varadharajan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64964
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"SideWinder Bullock", please check your private messages for an important administrative matter.
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic