my dog learned polymorphism*
The moose likes JDBC and the fly likes Invalid cursor state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invalid cursor state " Watch "Invalid cursor state " New topic
Author

Invalid cursor state

nabou diack
Greenhorn

Joined: Oct 17, 2001
Posts: 13
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
{
try{
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
while(rs2.next())
{
afacturerinfos infos = new afacturerinfos();

infos.noprojet = rs2.getString("NoProjet");
Long noproj = new Long (infos.noprojet);
//System.out.println(noproj);
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");

afacturerlist2.addElement(infos);
}
return afacturerlist2;
}
}
}
catch (Exception e){e.printStackTrace();}
return null;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid cursor state
 
Similar Threads
More Simplified version of the question bellow !
multiple processes... only want one
Resultset
Problem with StringBuffer
How to display Dynamic Menus and sub-menus using <s:iterator> tag in struts