Open source software supply chain lighting plan, waiting for you>>>
1. Reference connection:
https://blog.csdn.net/huangbiao86/article/details/6428608
After tossing all morning, I found out the cause of the mistake. Ah… Tragedy
Confirm that the package has been imported into the web project directory
It turned out that Tomcat could not find the MySQL jar package. Later, I imported mysql-connector-java-5.1.7-bin.jar into Tomcat’s lib directory, and it was OK. Hey
In Java project, you only need to introduce mysql-connector-java-5.1.7-bin.jar to run java project
In Web project, when class. Forname (“OM. Mysql. JDBC. Driver”); MyEclipse doesn’t look for strings or drivers. So just copy mysql-connector-java-5.1.7-bin.jar to Tomcat’s lib directory