title: SQLException - invalid cursor state
body: <p>I am coding a simple CRUD Application in java and I have a Method to select Produkts that go with bills.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public Rechnung selectProdukte(int target){
      int tempProdukt;
      int tempAnzahl;
      try {
          PreparedStatement ps1=hsqlmanager.getConnection().prepareStatement("SELECT produkt, anzahl from gekauftes_produkt " +
                  "WHERE rechnung= " + target + ";");
          //ps1.setInt(1, target);
          //Query 1wird executiert
  
          PreparedStatement ps2 = hsqlmanager.getConnection().prepareStatement("SELECT * FROM rechnung WHERE id= " + target + ";");
          //ps2.setInt(1, target);
          ResultSet rs1 = ps1.executeQuery();
          ResultSet rs2 = ps2.executeQuery();
          Rechnung erg=new Rechnung(); 
          erg.setId(rs2.getInt(1));
          erg.setDatum(rs2.getDate(2));
          erg.setSumme(rs2.getDouble(3));
          while(rs1.next()){
              tempProdukt=rs1.getInt(1);
              tempAnzahl=rs1.getInt(2);
              erg.addGekauftTupel(tempProdukt, tempAnzahl);
          }
          ps1.close();
          ps2.close();
          return erg;
      } catch(Exception e) {
          log.error("Fehler in DAO Rechnung  - selectProdukte: " + e);
      }
      return null;
  }
  </code></pre>
  
  <p>When I press the Button to execute the code I get:</p>
  
  <blockquote>
    <p>java.sql.SQLException: invalid cursor state: identifier cursor not
    positioned on row in UPDATE, DELETE, SET, or GET statement: ;
    ResultSet is positioned before first row</p>
  </blockquote>
  
  <p>I checked the db and all the tables and entities exist. So my question is:</p>
  
  <p>What does that mean?</p>
  
  <p>I appreciate your answer!!!</p>
  
  <p>PS.: I am using hsql db!</p>