Очень много ошибок в этом коде:
String qry2 = null;
Prepared statement ps2 = null; // Data type is `PreparedStatement`, not `Prepared statement`
// Don't call `sum()` unless you're summing multiple rows, and you're not.
// What is `MAL Arts`? Column names cannot have spaces, unless you quote
// the name, and you really don't want to be doing that.
qry2 = " UPDATE term1 SET Total_Score = sum(English + Social_Science + Science + Maths + PE + MAL Arts) WHERE SID = ?";
ps2.=conn.prepareStatement(qry2); // no period before =
Int res2=ps2.executeUpdate(); // Data type is `int`, not `Int`
Похоже, ваш код должен быть:
String qry2 = "UPDATE term1" +
" SET Total_Score = English + Social_Science + Science + Maths + PE + MALArts" +
" WHERE SID = ?";
int res2;
try (PreparedStatement ps2 = conn.prepareStatement(qry2)) {
ps2.setInt(1, sid);
res2 = ps2.executeUpdate();
}
// code using `res2` here