操作步骤

/*
* 操作步骤:
* 1: 导包
* 2: 注册驱动
* Class.forName("com.mysql.jdbc.Driver");
* 3: 获取数据库连接对象
* Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/school","root","root");
* 4:定义sql 语句
* Stirng sql = "update student set uname = '张无忌' where id = 901";
* 5: 获得执行sql语句对象 Statement
* Statement stat = con.createStatement(sql);
* 6: 执行sql 语句
* int i = stat.executeUpdate(sql);
* 7 处理结果
* System.out.println(i);
* 8 释放资源
* stat.close();
* con.close();
* */
原文地址:https://www.cnblogs.com/LFY001023/p/10635185.html