Each ResultSet belongs to a Statement, and each Statement is associated with a database cursor, which is generally a limited resource in databases. MySQL doesn't have an upper limit, but having too many open cursors will affect database performance
You don't have to close ResultSets (for example it will be closed and reopened if you re-execute the statement) but you must close Statements or you will leak database resources.
From the ResultSet documentation:
A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results.
Some databases like Oracle will return errors such as ORA-01000: Too many open cursors once you exceed the (configurable) per-session limit.
In general, you should close Statements as soon as possible. Using Java 7's try-with-resources is very convenient:
try (final Statement s = conn.createStatement()) {
final ResultSet rs = s.executeQuery(sql);
while (rs.next()) {
// process each row of the result
}
} // statement is auto-closed
If you are repeating the same query multiple times where only the query parameters vary, use a PreparedStatement.