Caused by: java.lang.RuntimeException: java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ

简介: Caused by: java.lang.RuntimeException: java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ
Caused by: java.lang.RuntimeException: 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.baomidou.mybatisplus.generator.config.DataSourceConfig.getConn(DataSourceConfig.java:206)
  at com.baomidou.mybatisplus.generator.config.querys.DecoratorDbQuery.<init>(DecoratorDbQuery.java:58)
  at com.baomidou.mybatisplus.generator.IDatabaseQuery$DefaultDatabaseQuery.<init>(IDatabaseQuery.java:97)
  at com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder.getTableInfoList(ConfigBuilder.java:139)
  at com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine.batchOutput(AbstractTemplateEngine.java:226)

解决:

private static String DATA_BASE_URL = "jdbc:mysql://127.0.0.1:3306/excel-data?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC";
    private static String DATA_BASE_USERNAME = "root";
    private static String DATA_BASE_PASSWORD = "root";
 
1.在连接字符串后面加上?serverTimezone=UTC
 
其中UTC是统一标准世界时间。
 
2.useUnicode=true&characterEncoding=UTF-8,这个是解决中文乱码输入问题
相关文章
|
20天前
|
SQL Java
使用java在未知表字段情况下通过sql查询信息
使用java在未知表字段情况下通过sql查询信息
34 8
|
2月前
|
SQL 分布式计算 Java
Hadoop-11-MapReduce JOIN 操作的Java实现 Driver Mapper Reducer具体实现逻辑 模拟SQL进行联表操作
Hadoop-11-MapReduce JOIN 操作的Java实现 Driver Mapper Reducer具体实现逻辑 模拟SQL进行联表操作
41 3
|
2月前
|
Java
用java实现Client和Server之间的互相通信
本文介绍了如何使用Java实现客户端和服务器之间的通信,包括服务器端创建ServerSocket、接受客户端连接、读取和发送消息,以及客户端创建Socket连接、发送和接收消息的完整过程。
60 0
用java实现Client和Server之间的互相通信
|
3月前
|
SQL Java
使用java在未知表字段情况下通过sql查询信息
使用java在未知表字段情况下通过sql查询信息
37 1
|
3月前
|
Java API Nacos
Caused by: java.lang.IllegalStateException: No Feign Client for loadBalancing defined. Did you forge
Caused by: java.lang.IllegalStateException: No Feign Client for loadBalancing defined. Did you forge
192 2
|
3月前
|
Java
flyway报错Caused by: java.lang.NoSuchMethodError: org.flywaydb.core.api.configuration.FluentConfigurat
flyway报错Caused by: java.lang.NoSuchMethodError: org.flywaydb.core.api.configuration.FluentConfigurat
50 2
|
3月前
|
关系型数据库 MySQL 网络安全
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
|
4月前
|
前端开发 Java
Java HotSpot(TM) 64-Bit Server VM warning
Java HotSpot(TM) 64-Bit Server VM warning
2377 1
|
4月前
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
72 3
|
4月前
|
SQL Java 数据库连接
【Azure 应用服务】Java ODBC代码中,启用 Managed Identity 登录 SQL Server 报错 Managed Identity authentication is not available
【Azure 应用服务】Java ODBC代码中,启用 Managed Identity 登录 SQL Server 报错 Managed Identity authentication is not available