title: "The result set is closed" error on nested execute query
body: <p>I want to write a query that should print values for xml tags from database in java.      </p>
  
  <pre><code>&lt;employee emp:empid=" " emp:empname="" /&gt;&lt;location loc:locname=" "/&gt;
  </code></pre>
  
  <p>The code below gives the error </p>
  
  <blockquote>
    <p>"The result set is closed". </p>
  </blockquote>
  
  <p>How can this be fixed?</p>
  
  <pre><code>        connection = dataSource.getConnection();
      ResultSet rs;
      connection.setAutoCommit(false);
      System.out.println("Connected to server OELDBSQL!!!");
      Statement stmt = connection.createStatement();
  
      String querystring = "select empid,empname from empt";
  
      rs = stmt.executeQuery(querystring);
      Element child1 = doc.createElement("employee");
      try {
          while (rs.next()) {
              child1.setAttributeNS(emp, "emp:empid", rs.getString(1));
              child1.setAttributeNS(emp, "emp:empname", rs.getString(2));
          }
              String querystring1 = "select locname from Locate";
              ResultSet rs1;
              rs1 = stmt.executeQuery(querystring1);
              while (rs1.next()) {
                  Element element = doc.createElement("location");
                  child1.appendChild(element);
  
                  element.setAttributeNS(loc, "loc:locaname", rs.getString(1));
              }
          } catch (Exception e) {
              System.out.println("Exception in connecting to DB"
                      + e.getMessage());
              System.err.println(e.getMessage());
          }
      } catch (Exception e) {
          System.out
                  .println("Exception in connecting to DB" + e.getMessage());
          System.err.println(e.getMessage());
      }
  </code></pre>