Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CLI0115E Invalid cursor state

 
Rehana Shaik
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am getting CLI0115E Invalid cursor state error when i run the following code

conn = getConnection();
query.append(" SELECT MAX(SUBSTR(SAP_BATCH_NUM,1,10))AS SAP_BATCH_NUM FROM FN_PAY_TRN ");
ps = conn.prepareStatement(query.toString());
ps.execute();
rs = ps.getResultSet();
rs.getString("SAP_BATCH_NUM");//iam getting this error at this level
i tried same query from command line processer it is working.
Please help me to solve this problem.
when i printed rs.wasNull() it is returning true.
Thanks
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ResultSets start in the 'before first' position: before you move to the first entry, you aren't looking at anything. This why you'll almost always see code like this:

Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic