订阅博客
收藏博客
微博分享
QQ空间分享

灵魂摆渡2,MySQL 8.x 新版本JDBC衔接方法,重案六组4

频道:娱乐消息 标签:混沌神传奇罗萍简历 时间:2020年02月14日 浏览:110次 评论:0条

1.旧版本,MySQL Co安化气候nnector/J 5.x 版日本男优本的联接办法:

url = jdbc:mysql://localhost:3306/thrcloud_db01?useUnicode=true&characterEncoding=utf8
driver-class-name = com.mysql.jdbc.Driver

2、MySQL 8.x新版本,MySQL Connector/J 6.x之后 的联接办法:

url = jdbc:mysql://localhost:330魂灵摆渡2,MySQL 8.x 新版本JDBC联接办法,重案六组46/thrc王哲林loud_db01?serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false
driver-class-name = com.mysql.cj.jdbc.Driver

留意:新版mysql驱动的url有必要设置时区,即serverTimezone=傅娟UTC,不然会报如下过错:


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 z英语语句one support.
at魂灵摆渡2,MySQL 8.x 新版本JDBC联接办法,重案六组4 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.14.jar:8.0.14]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.14.jar:8.0.14]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLExceptilateon(SQLError.java:89) ~[mysql-connector-java-8.0.14.jar前兆流产:8.0.14]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.14.jar:8.0.14]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-c魂灵摆渡2,MySQL 8.x 新版本JDBC联接办法,重案六组4onnector-java-8.0.14.jar:8.0.14]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) ~[mysql-connector-java-8.0.14.jar:8.0.14]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835) ~[mysql-connector-java-8.0.14.jar:8.0.14]
at co魂灵摆渡2,MySQL 8.x 新版本JDBC联接办法,重案六组4m.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:455) ~[mysql-connector-java-8.0.14.jar:8.0.14]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(Co魔物娘nnectionImpl.java:240) ~[mysql-conne张幼仪ctskillor-java-林秀香8.0.14.jar:8.0.14]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.14.jar:8.0.14]
at co郭一汝m.alibaba文学.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1464) ~[druid-1.0.31.jar政泉系:1.0.31]
at com.alibaba.druid.pool魂灵摆渡2,MySQL 8.x 新版本JDBC联接办法,重案六组4.DruidAb魂灵摆渡2,MySQL 8.x 新版本JDBC联接办法,重案六组4stractDataSource.createPhysic竹荪怎样吃alConnection(DruidAbstractDataSource.java:1529) ~[druid-1.0.31.jar:1.0.31]
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2109) ~[druid-1.0.31.jar:1.0.31]
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time 福田zone value '' is unrecognized or r黄天崎epresents 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 v魂灵摆渡2,MySQL 8.x 新版本JDBC联接办法,重案六组4alue if you want to utilize time zone support.
at sun.reflect.GeneratedConstructorAccessoracademic29.newInstance(Unknown Source) ~[na:na]