import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.junit.Test;
import java.beans.PropertyVetoException;
import java.sql.Connection;
public class DataSourseT {
@Test
public void test1() throws Exception {
ComboPooledDataSource dataSourse = new ComboPooledDataSource();
dataSourse.setDriverClass("com.mysql.cj.jdbc.Driver");
dataSourse.setJdbcUrl("jdbc.url=jdbc:mysql://localhost:3306/db1?serverTimezone=UTC");
dataSourse.setUser("root");
dataSourse.setPassword("109922");
Connection connection = dataSourse.getConnection();
System.out.println(connection);
connection.close();
}
}
报错信息
java.sql.SQLException: 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.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)