Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Invalid cursor state

nabou diack
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi do you know how to solve the invalid cursor state error I am getting on this code.
I am actually trying to do a query inside another query. thanks for your help
public synchronized Vector getafacturer( Remote handle) throws java.rmi.RemoteException
Statement st2 = initTransaction(handle);

if(st2 != null)
clientInfos client = getClientInfosFromHandle(handle);
if( (client.classLevel == ADMINISTRATOR) | | (client.classLevel == SUPERVISOR) )
String query1, query2;
//Vector list2 = new Vector();
Vector afacturerlist2 = new Vector();

/* query1 = " SELECT * FROM ListeProjet";*/

query2= " SELECT NoProjet, Expr1 FROM heurestravaillees";

System.out.println("SQL: " + query2);
ResultSet rs2 = st2.executeQuery(query2);
//infos.heurestravaillees= rs2.getDouble("Expr1");
//ajoute les factures a la liste
afacturerinfos infos = new afacturerinfos();

infos.noprojet = rs2.getString("NoProjet");
Long noproj = new Long (infos.noprojet);
infos.heurestravaillees= rs2.getDouble("Expr1");

query1 = "SELECT DISTINCT Facture.NoProjet, Sum(FactureDetail.HeuresFacture) AS Sumhf " +
"FROM Facture INNER JOIN FactureDetail ON Facture.NoFacture = FactureDetail.NoFacture " +
"WHERE Facture.NoProjet =" +noproj+
" GROUP BY Facture.NoProjet";

System.out.println("SQL: " + query1);
ResultSet rs3 = st2.executeQuery(query1);
infos.heuresfacturees= rs3.getDouble("Sumhf");

return afacturerlist2;
catch (Exception e){e.printStackTrace();}
return null;
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!