MyBatis test error no suitable driver found for JDBC ... Solutions

Source: Internet
Author: User

Original link: http://www.blogjava.net/w2gavin/articles/217864.html

Today appears the code appears no suitable driver found for jdbc, is also searched the on-line data, basically said is three questions:
One is: The connection URL format problem (Connection conn=drivermanager.getconnection ("Jdbc:mysql://localhost:3306/xx", "root", "XXXX")
The second is: drive string error (Com.mysql.jdbc.Driver)
The third is that the classpath does not add the proper MYSQL_JDBC drive.
After my careful examination, these three kinds of mistakes I have not committed, why.
Trying 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 solves the problem.
It turns out that it's not just about adding drivers to the classpath, but that you need to add that jar package to the outside jar package in the Java runtime, and alas, the next low-level mistake is less of a crime.

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.