我在jdk1.7中用maven引入官方最新的mysql驱动
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
结果运行时一直报错
Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException:Cannot find class:com.mysql.jdbc.Drive
我网上查有人说配置文件有空格,我检查我的并没有空格
解决方案:
我的是因为引入的驱动版本太高了,导致莫名错误,改成低版本就好了
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.8</version>
</dependency>