mysql8.0版本以上四大配置参数:
Class.forName("com.mysql.cj.jdbc.Driver");
//“com.mysql.jdbc.Driver”已不被赞成。
String url = "jdbc:mysql://localhost:3306/exam" +
"?serverTimezone=GMT"+ //修正时区问题,GMT(格林威治时间)也可写为UTC(世界统一时间)。
"&useServerPrepStmts=true" + //开启预编译
"&cachePrepStmts=true",+ //开启缓存编译后函数key
"&rewriteBatchedStatements=true" //开启批处理
String username = "root";
String password = "******";