问题具体名称: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
在学习JDBC课程时我们使用mysql-connector-java-5.1.7包导入eclipse中进行连接,但是如果我们使用的MySQL是8.0或以上版本则会出现无法连接的情况,解决方法网上有相关介绍,主要是需要更新包,链接:JDBC。删除5.1.7版本,导入最新版本后,更改url(包括设置时区及SSL等)后从新连接出现如题的错误。后来查看Build path查发现,虽然在lib包中已经删除了5.1.7版本的包,但是在Builid path中的Classpath还是可以查到5.1.7版本没有删除。而将老版本在这删除后,便能够正常连接MySQL。
方法:对新的包点击右键选择Build Path–>configure Build Path即可找到
新人,如有疏漏还请多多指教