After creating a statement, one can recieve a resultSet by two means:
...
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
or
...
Statement stmt = conn.createStatement();
int rows = stmt.executeUpdate(sql);
ResultSet rs = stmt.getResultSet(sql);
I've always used the latter because it easily supplies me with the row count without having to go through rs.last() and rs.getRow() etc..
However, I only recently read the javaDoc for executeUpdate(), which claimed that the method should only be used for INSERT,UPDATE, or DELETE statements and would throw a SQLException if a ResultSet was produced. This, obviously, is false considering I've been using it for a while with SELECT statements.
Is this just an small error on Sun's part? Do the rest of you use executeUpdate() with SELECT statements also?