我的程序在打印hello in getImportance beg后立即终止。为什么这样?我的MAIL表具有值。
Connection connection = connectToDatabase();
Statement stmt = connection.createStatement();
ResultSet mailset = stmt.executeQuery("SELECT SUBJECT from MAIL");
ResultSet keywordset = stmt.executeQuery("SELECT SKEYWORD FROM KEYWORD");
System.out.println("hello in getImportance beg");
while(mailset.next())
{
System.out.println("hello in first while");
while(keywordset.next())
{
System.out.println("hello in second while");
if(mailset.getString("SUBJECT").equals(keywordset.getString("SKEYWORD")));
{
System.out.println("hello in if");
stmt.executeUpdate("UPDATE KEYWORD SET IMPORTANCE = IMPORTANCE'" + 1 + "'");
stmt.executeUpdate("COMMIT");
}
}
}
mailset.close();
keywordset.close();
connection.close();我错过了什么?
谢谢!
感谢大家的回复。在第一个while之后定义第二个ResultSet这个技巧。