In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what is the difference between om.mysql.jdbc.Driver and com.mysql.cj.jdbc.Driver in mysql. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Com.mysql.jdbc.Driver is from mysql-connector-java 5.
Com.mysql.cj.jdbc.Driver is from mysql-connector-java 6.
Download address: https://dev.mysql.com/downloads/connector/j/5.1.html
Warehouse address: https://mvnrepository.com/artifact/mysql/mysql-connector-java
Mysql-connector-java 5
Mysql mysql-connector-java 5.1.49
1. JDBC connection Mysql5 com.mysql.jdbc.Driver:
DriverClassName=com.mysql.jdbc.Driverurl=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=falseusername=rootpassword=
2. When JDBC connects to Mysql6 com.mysql.cj.jdbc.Driver, you need to specify the time zone serverTimezone:
DriverClassName=com.mysql.cj.jdbc.Driverurl=jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=falseusername=rootpassword=
When setting the time zone, if you set serverTimezone=UTC, it will be 8 hours earlier than China time. If you are in China, you can choose Asia/Shanghai or Asia/Hongkong, for example:
DriverClassName=com.mysql.cj.jdbc.Driverurl=jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=falseusername=rootpassword=
Note:
I. If mysql-connector-java uses more than 6. 0, as follows:
Mysql mysql-connector-java 6.0.6
But if you still use com.mysql.jdbc.Driver for your driver, you will report an error:
Loading class' com.mysql.jdbc.Driver'. This is deprecated. The new driver class is' com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
At this point, you need to change com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver
II, and one more warning:
WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45mm, 5.6.26 + and 5.7.6 + requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
It is not recommended to establish a SSL connection without server authentication.
If it is not explicitly set, MySQL version 5.5.45, version 5.6.26 + and 5.7.6 + requires the establishment of a SSL connection by default.
To match applications that do not currently use SSL connections, the verifyServerCertificate property is set to 'false'.
If you do not need to use SSL connections, you need to explicitly disable SSL connections by setting useSSL=false.
If you need to connect with SSL, provide a truststore for server certificate verification and set up useSSL=true.
SSL-Secure Sockets Layer (secure socket layer)
This is the end of the article on "what is the difference between om.mysql.jdbc.Driver and com.mysql.cj.jdbc.Driver in mysql". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.