PreparedStatement ps = conn.prepareStatement("delete from " + tableName); int rows = ps.executeUpdate(); System.out.println (rows + (rows == 1 ? " row " : " rows ") + "deleted from table " + tableName);
PreparedStatement ps = null; try { ps = conn.prepareStatement("delete from " + tableName); int rows = ps.executeUpdate(); System.out.println (rows + (rows == 1 ? " row " : " rows ") + "deleted from table " + tableName); } finally { if (ps != null) { ps.close(); } }
  private void executeDeletion(Connection conn, String tableName)  throws SQLException  {    PreparedStatement ps = conn.prepareStatement("delete from " + tableName);    int rows = ps.executeUpdate();    System.out.println      (rows       + (rows == 1 ? " row " : " rows ")       + "deleted from table "       + tableName);  }