This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Invalid cursor state  RSS feed

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;
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!