使用数据库(DB)

import java.sql.*;

try {
    Connection conn = DriverManager
        .getConnection(url, userName, password);
    // Connect to the database
    // ...

    PreparedStatement stmt = conn.prepareStatement(
        "DELETE FROM city " +
        "WHERE ID = ?");
    stmt.setInt(1-1);
    stmt.execute();

    conn.close();   
}
catch (Exception e) {
    e.printStackTrace();
}