title: Error S1000 trying to execute more MySql queries in a Java Application
body: <p>I have a problem trying to execute more than one query into my Java Application code.
  I have a procedure that is called in main and is in the class "Fant":</p>
  
  <pre><code>    public void XXX(){
       Connectivity con=new Connectivity(); // this class set up the data for the connection to db; if ( !con.connect() ) {
                      System.out.println("Error during connection.");
                      System.out.println( con.getError() );
                      System.exit(0);
                  }
          ArrayList&lt;User&gt; blabla=new ArrayList&lt;User&gt;();
          blabla=this.getAllUsers(con);
          for (User u:blabla)
           {
             try {
                  Connectivity coni=new Connectivity();//start a new connection each time that i perform a query
                  Statement t;
                  t = coni.getDb().createStatement();
  
                 String query = "Select count(*) as rowcount from berebe.baraba";
                 ResultSet rs = t.executeQuery(query);
                 int numPrenotazioni=rs.getInt("rowcount");
                  rs.close();                           //close  resultset
                  t.close();                            //close statement
                  coni.getDb().close();                  //close connection
                  }
            }
              catch (SQLException e)
                   {
  
                    System.err.println("SQLState: " +
                    ((SQLException)e).getSQLState());
                    System.err.println("Error Code: " +
                    ((SQLException)e).getErrorCode());
                  }
           }
              }
  </code></pre>
  
  <p>The called function is defined as:</p>
  
  <pre><code>ArrayList&lt;User&gt; getAllUsers(Connectivity con) {
   try{
              ArrayList&lt;User&gt; userArrayList=new ArrayList&lt;User&gt;();
              String query = "Select idUser,bubu,lala,sisi,gogo,gg  from berebe.sasasa";
              Statement t;
              t = con.getDb().createStatement();
              ResultSet rs = t.executeQuery(query);
  
              while (rs.next())
              {
                  User utente=new User(....); //user fields got from query
                  userArrayList.add(utente);
              }
                rs.close();
                t.close();
                con.disconnect(); //disconnect the connection
                return userArrayList;
              } catch (SQLException e) {
  
          }
          return null;
  
      }
  </code></pre>
  
  <p>The main is:</p>
  
  <pre><code> public static void main(String[] argv) {
      ArrayList&lt;User&gt; users=new ArrayList&lt;User&gt;();
      System.out.println("-------- MySQL JDBC Connection Testing ------------");
      Fant style = new Fant();
      style.XXX();
  
  }
  </code></pre>
  
  <p>The query performed into "getAllusers" is executed and into the arraylist "blabla" there are several users; the problem is that the second query that needs the count is never executed. 
  The MYSQlState given when running is= "S1000" and the SQLERROR is "0".
  Probably i'm mistaking on connections issues but i'm not familiar with statements,connections,resultsets.
  Thank you. </p>