zoukankan      html  css  js  c++  java
  • Spring boot +mybatis 连接mysql数据库,获取JDBC失败,服务器时区价值”Oйu±e×¼e±¼的识别或代表多个时区

    报出的错误

    Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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.

    错误原因为jdbc配置文件

    错误文件

    spring.datasource.url=jdbc:mysql://localhost:3306/book
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

    解决:在url连接后加上

    ?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    正确:
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
    spring.datasource.url=jdbc:mysql://localhost:3306/book?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
  • 相关阅读:
    node=day5
    封装异步API
    form表单的name作用
    关于app.use('/static', express.static(path.join(__dirname, 'public')))的理解
    node=day4
    PS切片
    WPF SDK研究 之 数据绑定
    C# WPF DataGrid控件实现三级联动
    wpf中的样式与模板
    WPF : ListBox的几种Template属性
  • 原文地址:https://www.cnblogs.com/alomsc/p/10665710.html
Copyright © 2011-2022 走看看