zoukankan      html  css  js  c++  java
  • 解决MYSQL-JDBC连接后报错

    一、The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must….

    原因:服务器时区不同导致的报错

    解决方案(1):在通过在数据库连接URL后,加上?serverTimezone=UTC

    image

    为什么是UTC

    环境需要:如要维护多国环境如中美,时区一致便与维护 

    避免风险:避免PDT时区换算出错

    解决方案(2):手动更改时区为当前时区

    show variables like '%time_zone%';

    set global time_zone=‘+8:00’;

    image

    二、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.
    原因:JDBC版本过高引起的,当前所用mysql是5.7.14-log,JDBC版本应该低于该版本

    解决方案:下载mysql-connector-java-5.1.45,重新导入到项目中

    image

    三、其余报错

    imageimage

    检查驱动名称dbdriver,驱动url路径,基本上都是写错导致的

    源码附上:https://github.com/MFanBB/mysql_JDBC

  • 相关阅读:
    kindeditor的使用
    阅读笔记(三)
    阅读笔记(二)
    架构漫谈
    阅读笔记(一)
    hdfs
    暑假周总结八
    暑假周总结七
    暑假周总结六
    暑假周总结五
  • 原文地址:https://www.cnblogs.com/MR-FANWB/p/8985958.html
Copyright © 2011-2022 走看看