java第二课 jdbc 实现数据库的增删改查
自定义方法类 DBUtil
package com.zr.util;
import java.sql.*;
public class DBUtil {
public static Connection getConnection() throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.jdbc.Driver");
Connection connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/wzbc","root","1234");
System.out.println("创捷连接成功");
return connection;
}
public static void closeAll(ResultSet resultSet, Statement statement,Connection connection) throws SQLException {
if(resultSet !=null){
resultSet.close();
}
if(statement !=null){
statement.close();
}
if