Your problem stems from the fact that
the subquery is an aggregation query (with
SUM()
functions and aGROUP BY
clause) so the result set returned by the Access Database Engine is not updatable, andin your
prepareStatement
call you specifyResultSet.TYPE_SCROLL_SENSITIVE
.
Those conditions conflict with each other, causing an error. Try this instead:
stmt = conn.prepareStatement(query,
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery();
// rs.beforeFirst(); // (disabled)