I'm currently trying to read data from a database using two Statements and two ResultSets, one of both for "mainresults" and the other two for temporary data.
mainresult = mainconn.executeQuery("SELECT problem_name, dir, sparse from problem");
while(mainresult.next()){
....
//I know, not the finest query, but it should do the job, shouldn't it?
tempresult = tempconn
.executeQuery("SELECT upper_name, complexity_name FROM problem_reduction "
+ "INNER JOIN problem ON problem_reduction.lower_name ="
+ "problem.problem_name WHERE problem_reduction.lower_name= \""
+ mainresult.getString("problem_name") + "\"");
//This is where the mainresults are gone (only if tempresult has an entry)
while (tempresult.next()) {
// set attributes from reductionWrapper
from = tempresult.getString("upper_name");
Complexity c = Complexity.getComplexity(tempresult
.getString("complexity_alias"));
// add attributes to reductionsTodo
reductionsTodo.add(new ReductionWrapper(curProblem, from, c));
}
eg. problem holds 20 entrys. For the 4th entry there are actually results for the tempresultset. So after parsing through those tempresults the reamining 16 results in mainresults are gone. The type of mainconn is Statement by the way, bad choice of name there sorry ;)
I should add that the methods in the second while loop have nothing to do with databaseconnections OR the resultsets. So, is there something I'm missing?
I know it's hard to analyse it without the full code but the error should actually be here..