Hi,
I need to compare 2 large ResultSets (may contain up to 100,000 records each), and output and differences between them. My current code is far too slow (normally around an hour before I terminate it), so I'm wondering if there's a more sophisticated way to do this comparison (perhaps using ArrayLists or HashMaps?) Anyway, here's the code I'm using - any ideas would be really appreciated. Thanks,
Daniel
DatabaseA_ResultSet.beforeFirst();
while (DatabaseA_ResultSet.next()) {
ComparisonStringA = DatabaseA_ResultSet.getString(1) + "-" + DatabaseA_ResultSet.getString(2);
foundMatch = "no";
DatabaseB_ResultSet.beforeFirst();
while (DatabaseB_ResultSet.next()) {
ComparisonStringB = DatabaseB_ResultSet.getString(1) + "-" + DatabaseB_ResultSet.getString(2);
if (ComparisonStringA.equalsIgnoreCase(ComparisonStri ngB)) {
foundMatch = "yes";
break;
}
}
if (foundMatch.equalsIgnoreCase("no")){
System.out.println("didn't find " + ComparisonStringA + " in entire resultSet");
}
}