The differences between com. mysql. jdbc. Driver and com. mysql. cj. jdbc. Driver,

Source: Internet
Author: User

The differences between com. mysql. jdbc. Driver and com. mysql. cj. jdbc. Driver,

Overview: com. mysql. jdbc. Driver is in mysql-connector-java 5, while com. mysql. cj. jdbc. Driver is in mysql-connector-java 6.

1. JDBC to connect to Mysql5 requires com. mysql. jdbc. Driver, for example:
DriverClassName = com. mysql. jdbc. Driver
Url = jdbc: mysql: // localhost: 3306/test? UseUnicode = true & characterEncoding = utf8 & useSSL = false
Username = root
Password = root

2. To connect JDBC to Mysql6, you must use com. mysql. cj. jdbc. Driver and specify the time zone serverTimezone. For example:
DriverClassName = com. mysql. cj. jdbc. Driver
Url = jdbc: mysql: // localhost: 3306/test? ServerTimezone = UTC &? UseUnicode = true & characterEncoding = utf8 & useSSL = false
Username = root
Password = root

3. When you set the time zone, serverTimezone = UTC is eight hours earlier than the China time. If you are in China, set serverTimezone = Shanghai or serverTimezone = Hongkong. For example:
DriverClassName = com. mysql. cj. jdbc. Driver
Url = jdbc: mysql: // localhost: 3306/test? ServerTimezone = Shanghai &? UseUnicode = true & characterEncoding = utf8 & useSSL = false
Username = root
Password = root

4. If mysql-connector-java uses more than 6.0, for example:
<Dependency>
<GroupId> mysql </groupId>
<ArtifactId> mysql-connector-java </artifactId>
<Version> 6.0.6 </version>
</Dependency>
However, if your driver still uses com. mysql. jdbc. Driver, an error will be reported. In this case, you need to change com. mysql. jdbc. Driver to com. mysql. cj. jdbc. Driver.

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.