连接数据库Connection

public class Basedao {static{//加载驱动try {Class .forName("com.mysql.cj.jdbc.Driver
public class Basedao {static{//加载驱动try {Class .forName("com.mysql.cj.jdbc.Driver");//加载驱动程序} catch (ClassNotFoundException e) { //捕捉驱动类未找到异常e.printStackTrace();//输出异常信息}}public static Connection getconn(){//创建一个连接对象Connection conn=null;try {conn= DriverManager.getConnection("jdbc:mysql://localhost:8080/mall?useSSL=false&serverTimezone=UTC","root","123456");//连接数据库路径,用户名,密码} catch (SQLException e) {e.printStackTrace();}return conn;//返回获取到的数据库连接对象}public static int executeIUD(String sql ,Object[] params){int count=0;Connection conn=Basedao.getconn(); //连接数据库//准备SQLPreparedStatement ps =null;//insert into user("""","")value(?,?,?)try {//准备SQLps=conn.prepareStatement(sql);   //创建语句//遍历参数for (int i=0;i