首先说下解决方案 使用mysql驱动的官方推荐类全名 替换mysql的驱动类全名
com.mysql.jdbc.Driver 替换为 com.mysql.cj.jdbc.Driver
主要会出现两个错误
1.找不到ping 测试的方法 Cannot resolve com.mysq.jdbc.Connection.ping method. Will use ‘SELECT 1’ instead.
2. 验证validationQuery报错 validateConnection false
还有一个警告 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.
主要原因就是两个驱动的实现不同导致的
spring 整合druid mybatis myql 时报错 validateConnection false
最新推荐文章于 2022-11-17 09:14:29 发布