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":
    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<User> blabla=new ArrayList<User>();
        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());
                }
         }
            }
The called function is defined as:
ArrayList<User> getAllUsers(Connectivity con) {
 try{
            ArrayList<User> userArrayList=new ArrayList<User>();
            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;
    }
The main is:
 public static void main(String[] argv) {
    ArrayList<User> users=new ArrayList<User>();
    System.out.println("-------- MySQL JDBC Connection Testing ------------");
    Fant style = new Fant();
    style.XXX();
}
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.