Spring出现org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get

180 阅读1分钟

代码写的正确,但是连接数据库出现错误,主要可能遇到一下集中情况: 1.mysql没有打开。 2.数据库版本问题,在db.properties中编写时 mysql5: driver=org.gjt.mm.mysql.Driver url=jdbc:mysql://localhost/test?&useUnicode=true&characterEncoding=utf-8 user=root pwd=root123 如果使用mysql8,就会报错因为在8中没有org这个包了,应当使用以下 mysql8: driver= com.mysql.jdbc.Driver
url=jdbc:mysql://localhost/test?useSSL=false&serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
user=root
pwd=123456 3.mysql-connection包版本太低,使用
mysql
mysql-connector-java
5.1.47