一、实现JDBC增加、删除、修改数据的常规操作
代码如下:
public static void main(String[] args) {
Connection connection = null;
Statement statement = null;
try {
Class.forName("com.mysql.jdbc.Driver");//1、加载驱动
connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test", "root", "root");//2、连接数据库
statement = connection.createStatement();//3、创建statement对象
for(int i=0;i<50;i++) {
String id = UUID.randomUUID().toString();
String sql = "insert into user_info(id,user_name,password)values('"+id+"','"+i+"','"+i+"')";//4、书写SQL语句
// String sql = "delete from user_info";//删除
// String sql = "update student set name='"+name+"',num