Java connection Mysql:no suitable Driver Found for JDBC workaround

Source: Internet
Author: User

Today, the code appeared no suitable driver found for jdbc, but also searched the online information, basically said the following questions:
One is: There was a problem with the connection URL format (Connection conn=drivermanager.getconnection ("Jdbc:mysql://localhost:3306/xx", "root", "XXXX")
The second is: drive string error (Com.mysql.jdbc.Driver)

The third is: the classpath did not add the appropriate MYSQL_JDBC drive

Four: Try to add the Mysql-connector-java-3.1.14-bin.jar jar package to the C:\Program Files\java\jre1.6.0_02\lib\ext folder

None of the above is successful:

I found a big red exclamation point in front of the project, and then the bread didn't show any errors, but it went wrong when it was running. Never knew what the reason was. I looked it up on the internet and found two methods:

(1) The library in the import of extra bags, after the deletion can be (I tried a bit, deleted the newly introduced package, it is really possible, but the next time to open the problem appeared again, and then found the second method).
(2) Remove all libraries from the Java build path and add it back in.
But why the big red exclamation point, is it all related to the package in the library, is no identification package?
The explanation is: "You create a new Web project with MyEclipse, a. Classpath configuration file is generated under the project directory, which is the configuration of the jar referenced in your project. this. Classpath does not have any effect on your Web project, it is actually for myeclipse identification. The reason you're saying this is because the. classpath file is configured to reference a jar, but in fact your Lib does not have the jar so there is a red hint. You don't have to take the. classpath file and your jar one by one, you open the MyEclipse right-click your Web project, find the build Path > Configure build paht ... > Then there are several tabs above to find LIBR  Aries What you see here is all the jars referenced in your project to see if there is a small yellow exclamation point on a jar icon? If some words are right, first select this jar, click on the right of the Remove > click OK Wait a few seconds, now the Web project above the Red xx is not, haha. Explanation: The jar of the yellow exclamation point indicates that the. Classpath configuration file references the jar, but in fact Lib does not have this jar.

Java connection Mysql:no suitable Driver Found for JDBC workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.