常见问题1:
报这个错误
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
翻译过来就是
加载类“com.mysql.jdbc.Driver”。这是弃用。新的驱动类是' com.mysql.cj.jdbc.Driver'。驱动程序是通过SPI自动注册的,手动加载驱动程序类通常是不必要的。
只需要改成就好了!
//加载驱动
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
常见问题2:
报这个错误
翻译过来大概意思就是
java.sql。SQLException异常:服务器时区价值”йʱ”无法识别或代表多个时区。如果您想利用时区支持,您必须配置服务器或JDBC驱动程序(通过'serverTimezone'配置属性)来使用更特定的时区值
如译文所示,有了第一种解决方式
使用serverTimez