Java connection to MySQL problem

Source: Internet
Author: User

Today learn how to use Java to manipulate the database, tutorial video There are two methods, one is JDBC-ODBC Bridge connection, one is the direct use of JDBC. I chose the latter.

But not as simple as the tutorial, the tutorial uses SQL Server 2000, I use MySQL, and then I am a small white one, in Baidu to find information to get their own.

First downloaded a JDBC driver, I downloaded the Mysql-connector-java-5.1.35-bin.jar, and then began to use in MyEclipse, the code is as follows: The code is not error, but when I run, it will appear this error

I am looking for information online, which may be caused by the following 4 reasons:

One: There was a problem with the connection URL format (Connection conn=drivermanager.getconnection ("Jdbc:mysql://localhost:3306/xx", "root", "XXXX")

Two: Error driving string (com.mysql.jdbc.Driver)

Three: The classpath does not include the appropriate MYSQL_JDBC driver (driver to be consistent with your database version)

Four: The drive jar package is placed in the wrong place.

I checked it out, one or two points right, and then I reconfigured the 3rd. For the fourth item, I put the jar bag inside the jdk/jre/lib/ext. However, this error is still displayed.

The MySQL I use is version 5.1.73, with the JDBC driver 5.1.35, I can't find the exact same version of MySQL as JDBC.

I suspect that the possible causes are:

The 1.JDBC differs from the MySQL version.

2. I have also installed 5.6 versions of MySQL before, and I am not sure whether these two different versions of the database will cause this problem.

Hope to have predecessors can point out, thank you.

Java connection to MySQL problem

Related Article

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.