I looked at many answers but unfortunately none answers my question and I still can't figure this out why I'm getting ResultSet closed.
Here is the try code snippet that`s causing the issue:
System.out.println(" System Info! @CHKMD5Files(): Found pre-existing details: "+TOTAL);
Statement stmMD5 = null;
Connection connMD5 = null;
ResultSet rs_MD5 = null;
String RESULTMD5 = null;
try {
connMD5 = DriverManager.getConnection("jdbc:sqlite:" + bkpPATH+ hostname + ".db");
stmMD5 = connMD5.createStatement();
connMD5.setAutoCommit(false);
while (ROWID <= TOTAL) {
rs_MD5 = stmMD5.executeQuery("SELECT md5 FROM details WHERE ROWID = '"+ROWID+"';");
RESULTMD5 = rs_MD5.getString("MD5");
skipBuffer.write(RESULTMD5);
skipBuffer.newLine();
skipBuffer.flush();
ROWID++;
}
System.out.println(" System Info! @CHKMD5Files(): Done with try");
} catch (Exception ex) {
System.out.println(" System Error! @CHKMD5Files (2): " + ex);
System.exit(5);
} finally {
if (stmMD5 != null){
stmMD5.close();
System.out.println(" System Info! @CHKMD5Files (2): Closing Statement(stmMD5)");
}
if (connMD5 != null) {
connMD5.close();
System.out.println(" System Info! @CHKMD5Files (2): Closing Connection(connMD5)");
}
skipBuffer.close();
}
}
Looks like the while loop does not even run because if I put print statement in the loop returns nothing.
executeof the statement