title: ResultSet exception - before start of result set
body: <p>I'm having trouble getting data from a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/ResultSet.html" rel="noreferrer"><code>ResultSet</code></a> object. Here is my code:</p>
  
  <pre><code>    String sql = "SELECT type FROM node WHERE nid = ?";
      PreparedStatement prep = conn.prepareStatement(sql);
      int meetNID = Integer.parseInt(node.get(BoutField.field_meet_nid));
      prep.setInt(1, meetNID);
  
      ResultSet result = prep.executeQuery();
      result.beforeFirst();
      String foundType = result.getString(1);
  
      if (! foundType.equals("meet")) {
          throw new IllegalArgumentException(String.format("Node %d must be of type 'meet', but was %s", meetNID, foundType));
      }
  </code></pre>
  
  <p>The error trace:</p>
  
  <pre><code>Exception in thread "main" java.sql.SQLException: Before start of result set
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:986)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:981)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
      at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:841)
      at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5656)
      at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5576)
      at nth.cumf3.nodeImport.Validator.validate(Validator.java:43)
      at nth.cumf3.nodeImport.Main.main(Main.java:38)
  </code></pre>
  
  <p>What am I doing wrong here?</p>