CodePudding user response:
Baidu is a good thingToday coding appeared No suitable driver found for JDBC, and searched the Internet information, basically all say three questions:
A: there was a problem in the Connection URL format (Connection conn=DriverManager. GetConnection (" JDBC: mysql://localhost: 3306/XX ", "root", "XXXX")
The second is: Driver error string (. Com. Mysql. JDBC Driver)
Three is not join the Classpath right mysql_jdbc drive
After I check, the three mistakes I have made, why?
Try to mysql connector - Java - 3.1.14 - bin. Jar jar package to join C: \ Program Files \ Java \ jre1.6.0 _02 \ lib \ ext directory, problem solved!!!!!
Turned out to be not only required to drive to join the classpath, and need to add the jars to the Java runtime environment of external jar package,
WEB - adding mysql INF \ lib - connector - Java - 3.1.14 - bin. Jar