public int retrieveRowCount(String tableName) throws SQLException {
  ResultSet rs=null;
  int rowCount=-1;
  try {
    rs=statement.executeQuery("SELECT COUNT(*) FROM " + tableName);
    rs.next();
    rowCount=rs.getInt(1);
  }
  finally {
    if (rs != null) {
      rs.close();
    }
  }
  return rowCount;
}

public int retrieveRowCount ( String tableName ) throws SQLException { ResultSet rs = null ; int rowCount = - 1 ; try { rs = statement . executeQuery ( "SELECT COUNT(*) FROM " + tableName ) ; rs . next ( ) ; rowCount = rs . getInt ( 1 ) ; } finally { if ( rs != null ) { rs . close ( ) ; } } return rowCount ; }
does a count on a given table .
