MySQL8.0以上的JDBC驱动的一些小的问题

  • 是使用Class.forName("com.mysql.cj.jdbc.Driver");而不是Class.forName("com.mysql.jdbc.Driver");与之前加载驱动的形式不同了
    关于MySQL的JDBC驱动问题记录

    通过java.sql.Driver文件查看加载驱动时的类是什么

  • 出现[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]类似的报错时,查看是中文乱码还是时间问题

    • 解决时间的报错 jdbc:mysql://localhost:3306/test?serverTimezone=UTC
    • 解决中文乱码的问题 jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8
    • 同时解决两个问题 jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

相关文章:

  • 2022-12-23
  • 2022-01-07
  • 2021-11-30
  • 2021-06-04
  • 2021-08-24
  • 2022-01-10
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2021-11-20
  • 2022-01-29
  • 2021-06-28
  • 2021-04-23
相关资源
相似解决方案