jdbc中的Driver报错
老师我的都导入了运行报错啊
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.
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 mysql.connector.java@8.0.14/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at mysql.connector.java@8.0.14/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at mysql.connector.java@8.0.14/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at mysql.connector.java@8.0.14/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at mysql.connector.java@8.0.14/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
正在回答
同学你好,建议同学在url连接后加上如下代码再试试。如:
?characterEncoding=UTF8&serverTimezone=HongKong
修改后的url为:
jdbc:mysql://localhost:3306/hello?characterEncoding=UTF8&serverTimezone=HongKong
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
- 参与学习 人
- 提交作业 277 份
- 解答问题 4297 个
Java数据库开发的必备技能,从流行的MySQL数据库开始,到Java原生的数据库管理接口JDBC的使用,再到常用的数据持久化框架MyBatis,让你向Java工程师的目标又迈进了一步!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星