title: Java: MySQL Query and return
body: <p>I'm trying to access my database, inject some SQL Code and return the value out of it.</p>
  
  <p>First of all, I'm a new to this stuff but I've came up with the following code:</p>
  
  <pre><code>  public static ResultSet checkCmdAmount() throws Exception {
          try {
            // This will load the MySQL driver, each DB has its own driver
            Class.forName("com.mysql.jdbc.Driver");
            // Setup the connection with the DB
            connect = DriverManager.getConnection(""+MyBot.mysqlDbPath+"",""+MyBot.mysqlDbUsername+"",""+MyBot.mysqlDbPassword+"");
            PreparedStatement zpst=null;
            ResultSet zrs=null;
            zpst=connect.prepareStatement("SELECT COUNT(1) FROM eigenebenutzerbefehle");
            zrs=zpst.executeQuery();
               return zrs;
          }catch (Exception e) {
                throw e;
              } finally {
                close();
              }
        }
  </code></pre>
  
  <p>In my return, I get the following:</p>
  
  <pre><code>ResultSet: com.mysql.jdbc.JDBC4ResultSet@196da649
  </code></pre>
  
  <p>But I want actually the Amount of rows in my table.
  When I execute the sql code through phpmyadmin I get 3 which is correct.</p>
  
  <p>What is wrong here?</p>