1.连接驱动类改为”com.mysql.cj.jdbc.Driver”
在之前的驱动类(com.mysql.jdbc.Driver.class)下有这样一段:
static {
System.err.println("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.");
}
意思就是要更换驱动类
2.连接url参数配置
需要再url中指明编码格式,SSL,时区等信息
完整配置:
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8