2020/12/11
继续昨天的代码
DBUtil.java
package com.pp;
import java.sql.*;
public class DBUtil{
private DBUtil() {}
static {
try {
Class.forName("com.mysql.jdbc.Driver");
}catch(ClassNotFoundException e) {
e.printStackTrace();
}
}
public static Connection getConnection() throws SQLException{
return DriverManager.getConnection("jdbc:mysql://localhost:3306/shujuku?serverTimezone=UTC&useUnicode=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true&characterEncoding=utf-8","root","123456");
}
public static void close(Connection conn,Statement ps,ResultSet rs) {
if(rs!=null) {
try {
rs.close();
}catch(SQLException s) {
s.printStackTrace();
}
}
if(ps!=null) {
try {
ps.close();
}catch(SQLException s) {
s.printStackTrace();
}
}
if(conn!=null) {
try {
conn.close();
}catch(SQLException s) {
s.printStackTrace();
}
}
}
}
package com.pp;
public class get {
String ab;
public String getAb() {
return ab;
}
public void setAb(String x) {
this.ab= x;
}
public get(String a) {
ab=a;
}
}
2,没有问题
3,明天一定给他弄完