java连接mysql,报JDBC driver错误

日志错误:
Oct 15, 2017 12:45:01 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Oct 15, 2017 12:45:01 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.

解决:更新mysql jdbc驱动程序
1、删掉java lib目录里边的文件mysql-connector-java......jar,同样在tomcat lib目录和程序lib目录里找到类似的文件,都要删除。
2、到https://dev.mysql.com/downloads/connector/j/下载最新的驱动,解压缩,把里边的mysql-connector-java-......-bin.jar拷贝到tomcat的lib目录。注意:必须是tomcat的lib目录,不能是 java lib目录,也不能是程序指定的lib目录。

股票开户就选东方财富证券,佣金低,送豪礼!

备注:
Connector/J 5.1 支持Mysql 4.1、Mysql 5.0、Mysql 5.1、Mysql 6.0 alpha这些版本。
Connector/J 5.0 支持MySQL 4.1、MySQL 5.0 servers、distributed transaction (XA)。
Connector/J 3.1 支持MySQL 4.1、MySQL 5.0 servers、MySQL 5.0 except distributed transaction (XA) support。
Connector/J 3.0 支持MySQL 3.x or MySQL 4.1