PDA

View Full Version : Cursor State not valid



Guest.Visitor
01-01-1995, 02:00 AM
Hi, I am trying to call a stored procedure from the 400 with a Java program. I am able to connect, and able to find the stored procedure. When I try to set the values of the parameters, and try to execute the query with the executeQuery() method I get a "Cursor State Not Valid" error message. I am not really sure what this means. I am passing the correct data types to the parameters. I have included part of the code below. If anyone knows what is causing this error message, I would really appreciate hearing from you. setCallableStmt(getConnect().prepareCall("CALL ROBERT.ID_NAME_LS(?, ?, ?, ?, ?)")); ResultSet rs = null; getCallableStmt().setInt(1, 1); getCallableStmt().setInt(2, 10); getCallableStmt().setString(3, getIDNumber()); getCallableStmt().setString(4, getName()); getCallableStmt().setInt(5, getSeqNum()); rs = getCallableStmt().executeQuery(); while (rs.next()) Thanks for your time and help, Amie

Guest.Visitor
08-09-2000, 08:38 AM
The error message probably means that your stored procedure does not return a result set. executeQuery() works only when the SQL statement returns a result set. execute() or executeUpdate() should be used for statements that don't return a result set. - Jeff Lee, AS/400 Toolbox for Java