title: JDBC driver throws "ResultSet Closed" exception on empty ResultSet
body: <p>I have a problem in JDBC driver for SQLite.</p>
  
  <p>I am executing a query with SELECT statement.</p>
  
  <p>If I get an empty <code>ResultSet</code> (0 rows) then I see a "Closed ResultSet" exception thrown when calling <code>getString(1)</code>.</p>
  
  <p>Without much prior JDBC experience, my theory (which I could not confirm via JavaDocs for <code>ResultSet</code>) is that</p>
  
  <ul>
  <li><code>getString(1)</code> does NOT work on an empty (zero-row) resultset (by design or due to a bug)</li>
  <li><code>ResultSet</code>'s "open" flag is set to <code>false</code> on zero rows (again, by design or a bug)</li>
  </ul>
  
  <p>I saw this <a href="http://www.mail-archive.com/sqlitejdbc@googlegroups.com/msg00702.html" rel="nofollow noreferrer">bug report</a> but am not sure if it's related.</p>
  
  <p>My qeustions are:</p>
  
  <ol>
  <li>Is the theory above correct?</li>
  <li>Is it a bug? Feature? (and if so, can someone point to documentation please?)</li>
  <li>Is it specific to SQLIte's JDBC or to generic <code>ResultSet</code> in all JDBC drivers?</li>
  <li><strong>What is the correct way of doing stuff like that?</strong>?</li>
  </ol>
  
  <p>For #4, my solution was to use <code>isFirst()</code> call right after <code>executeQuery()</code> to check whether any rows are there in result set. Is this the best practice approach?</p>
  
  <p>(I could also have simply selected a count insetad since I didn't really need a result set, merely zero-nonzero flag, but I want to know the correct thingh to do if I did care about select's results)</p>
  
  <p>Thanks!</p>