BaseDao
public class BaseDao {
public static Connection getConn() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/j11?useSSL=false&CharacterEncoding=UTF-8&server=TUC",
"root", "19990507");
return conn;
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return null;
}
public static void close(ResultSet rs, Connection conn, Statement sts) {
try {
if (rs != null)
rs.close();
if (conn != null)
conn.close();
if (sts != null)
sts.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
}