title: how to check database table is empty or not
body: <p>i have a  database with a table 'admin'.But presently just creating table not having any values.table columns are user_name and password.My motive is to check whether the table is empty or not.I am using mysql database.I tried following code and its fails.Please help me.</p>
  
  <pre><code>public void nullCheck() {
  
      PreparedStatement stmt = null;
      ResultSet rs = null;
      String qry = "SELECT * From admin ";
  
      try {
          stmt = (PreparedStatement) conn.prepareStatement(qry);
          rs =  stmt.executeQuery();
  
          boolean empty = true;
          while( rs.next() ) {
            // ResultSet processing here
            empty = false;
          }
          if( empty ) {
              Util.showWarningMessageDialog("null");
          }
      } catch (SQLException ex) {
          Logger.getLogger(RemoveFaculty.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
  </code></pre>