Link to home
Start Free TrialLog in
Avatar of gdlp2004
gdlp2004

asked on

Cursor State Not Valid

I am using the following result set and prepared statement.  The update query works, but the a "CURSOR STATE NOT VALID"
exception occurs and the rest of my code is ignore. Thanks in advance to anyone that can help.

String updateDb2Query = "UPDATE tstdtatst.A767040A set ORCPDT = '"+bReqCompDate+"', ORFL = '"+flag+"', ORACTN = '"+action+"', ORFIH = "+frontInsideHeight+",ORRIH = "+rearInsideHeight+",ORFLRT="+floorRate+",ORLNID="+lineSplit+", ORDATE='yyyy-mm-dd',ORGDTE='yyyy-mm-dd', ORTPRC="+bTotal+", ORTCST="+bTotalCost+", ORTMRG="+bTotalMargin+", ORQTY="+bTotalQty+",ORMODL='"+bModel+"',ORCO='"+bPlant+"',ORSLSF='"+salesfname+"', ORSLSL='"+saleslname+"', ORCUST="+customerJdeNum+", ORPRCD='"+productCode+"',ORDAUT='"+discountNumber+"',ORUSER='"+salesmanId+"' where ORGORN = "+oracleId+"";
pUpdateDb2Query = db2.prepareStatement(updateDb2Query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rsUpdateDb2Query = pUpdateDb2Query.executeQuery();
rsUpdateDb2Query.close();  pUpdateDb2Query.close();
Avatar of gdlp2004
gdlp2004

ASKER

I found the answer...you need to replace rsUpdateDb2Query = pUpdateDb2Query.executeQuery(); with .executeUpdate();
ASKER CERTIFIED SOLUTION
Avatar of CetusMOD
CetusMOD
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial