public class xiu {
private static int id;
public static void main(String[] args) {
Connection connection;
PreparedStatement stmt;
String URL = "jdbc:mysql://rm-2ze1h274pv1j5xbc58o.mysql.rds.aliyuncs.com:3306/cww";
String USER = "cww";
String PASSWORD = "grj5201314!";
String sql = "Update 测试1 Set id=?, username = ? where password = ?";
try {
Class.forName("com.mysql.cj.jdbc.Driver");
connection = DriverManager.getConnection(URL, USER, PASSWORD);
stmt = connection.prepareStatement(sql);
stmt.setInt(1, 2);
stmt.setString(2,"chand");
stmt.setString(3, "464845");
stmt.executeUpdate();
stmt.close();
}catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}