<p>I've executed a JDBC query to obtain a resultset. Before iterating over it, I'd like to quickly find out how many rows were returned. How can I do this with high performance?</p>

<p>I'm using Java 6, Oracle 11g, and the latest Oracle JDBC drivers.</p>

Short answer: you can't.
Long answer: you can't, partly because the database may be lazily evaluating the query, only returning rows as you ask for them.
EDIT: Using a scrollable ResultSet you can :)
Indeed, I asked this very question in the Java databases newsgroup a long time ago (back in 2001!) and had some
helpful responses
.