table of Contents
First, there is a problem
Since the database version of the upgrade, there will be a lot of problems to solve another occurrence. Issues
such as
1、
No suitable driver mysql
2、
Unsupported major.minor version 5
3. Other problem is not reproduced
Second, the problem is solved
For the first question is obviously a problem because the drive MySql version upgrades, and the second due to the Java version of the problem.
1, environment configuration
- win10
- JDK 1.7/1.8
- eclipse
- MySql 8.0.1
2, pom configuration, the drive to solve the problem
- mysql-connector-java: 8.0.16 (may be the latest)
- c3p0: 0.9.5.2 (driver MySql8.0 must use more than 0.9.5.2 c3p0 version)
- mchange-commons-java: 0.2.11 (version 0.9.5.2 c3p0 above, there must be mchange)
Maven in c3p0-0.9.5.2 version may be downloaded for it, anyway, I did not go to the following connection
https://sourceforge.net/ projects / c3p0 /
Copy downloaded jar package to the corresponding folder maven
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
<!-- c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>mchange-commons-java</artifactId>
<version>0.2.11</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
3, jdbc connection configuration, the drive to solve the problem
driver may be "com.mysql.jdbc.Driver", can be "com.mysql.cj.jdbc.Driver"
Pro-test can
datasource.type=mysql
datasource.autoCommitOnClose=false
datasource.driverClassName=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://127.0.0.1:3306/kedarjxy?useUnicode=true&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
datasource.username=root
datasource.password=********
serverTimezone = UTC this otherwise it will have to add report
The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
zeroDateTimeBehavior = convertToNull this otherwise they will have to increase newspaper
java.sql.SQLException: Value ‘0000-00-00’ can not be represented as java.sql.Date