title: PSQLException: this ResultSet is closed
body: <p>i've occours this strange error for the first time in my life, and i don't know what does it means. I've a class that retrieve information from a table on a postgresql database, do some operations and return an arraylist with parsed element:</p>
  
  <pre><code>ResultSet rs = ProduttoreDCS.getProduttori();
          System.out.println("Recuperato result set produttori");
          ArrayList&lt;String[]&gt; res = new ArrayList&lt;String[]&gt;();
  
  
          while (rs.next()) {
              String[] current = new String[6];
  
              current[0] = Integer.toString(rs.getInt("partita_iva"));
              current[1] = rs.getString("nome");
              current[2] = rs.getString("cognome");
              current[3] = rs.getString("via_sede");
              current[4] = rs.getString("citta_sede");
              current[5] = rs.getString("provincia_sede");
  
              res.add(current);
              current = null;
          }
  
          return res;
  </code></pre>
  
  <p>the error is on "while" line.</p>
  
  <pre><code>public static ResultSet getProduttori() throws ClassNotFoundException, SQLException {
      /*
       * retrieve all record from produttori table
       */
      Connection conn = null;
      ResultSet res = null;
      Statement stmt = null;
      String query = "SELECT * FROM produttore";
  
      conn = ConnectionManager.getConnection();
      System.out.println("Connection obtained by ProduttoreDCS class");
      stmt = conn.createStatement();
      res = stmt.executeQuery(query);
  
      stmt.close();
      conn.close();
  
  
      return res;   
  }
  </code></pre>