一.JDBC驱动的版本号以及名称问题

区别:

  com.mysql.jdbc.Driver 是 mysql-connector-java 5中的

  com.mysql.cj.jdbc.Driver 是 mysql-connector-java 6以上的版本中的

注意,我这里使用的是springboot2.1.1版本,在pom.xml文件中整合mysql后自动引入的mysql-connector-java版本是8.x,因此需要使用com.mysql.cj.jdbc.Driver 这个驱动

如图:

    <!-- springboot版本-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent> <!-- 省略其他依赖--> <!-- mysql 这里没有显示的指定版本,默认集成的版本是8.x-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>

注意:如果使用 com.mysql.jdbc.Driver,项目启动时,控制台会报错,表示该驱动已经过时

二.ServerTimeZone时区的问题

在设定时区的时候,如果设定serverTimezone=UTC,会比中国时间早8个小时,如果在中国,可以选择Asia/Shanghai或者Asia/Hongkong,例如:

url:jdbc:mysql://localhost:3306/mango?serverTimezone=Asia/Shanghai&useUnicode=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true&characterEncoding=utf-8

注意:

   如果在url这里不设置时区,则可能报错

三.服务器直连mysq问题

不推荐不使用服务器身份验证来建立SSL连接。SSL – Secure Sockets Layer(安全套接层)

如果未明确设置,MySQL 5.5.45+, 5.6.26+ and 5.7.6+版本默认要求建立SSL连接。

为了符合当前不使用SSL连接的应用程序,verifyServerCertificate属性设置为’false’。或者使用autoConnect=true显示的支持直连
如果你不需要使用SSL连接,你需要通过设置useSSL=false来显式禁用SSL连接
如果你需要用SSL连接,就要为服务器证书验证提供信任库,并设置useSSL=true。

Jdbc Driver驱动和ServerTimeZone时区的的问题的更多相关文章

  1. com.mysql.jdbc.Driver 和 com.mysql.cj.jdbc.Driver的区别 serverTimezone设定

    转自: http://blog.csdn.net/superdangbo/article/details/78732700 com.mysql.jdbc.Driver 和 com.mysql.cj.j ...

  2. 异常: 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 configurat

    异常: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. ...

  3. 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

    java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more tha ...

  4. 【转载】在使用JDBC连接MySql时报错: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连接MySql时报错:You must configure either the server or JDBC driver (via the serverTimezone config ...

  5. You must configure either the server or JDBC driver (via the serverTimezone configuration property

    使用JDBC连接MySql时出现:The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one ...

  6. idea报错: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 configu

    java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more tha ...

  7. 三、SpringBoot启动时JDBC报错:You must configure either the server or JDBC driver (via the serverTimezone configuration property)

    错误提示: Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connectio ...

  8. 连接数据库:ERROR: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 prop

    本打算在maven项目中配置mybatis试试看,想到mybatis如果不是在容器中运行,那么他的事务控制实际上可以使用的是jdbc的提交和回滚,这就要在pom.xml文件中配置mysql-conne ...

  9. 使用JDBC连接MySql时出现: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

    在连接字符串后面加上?serverTimezone=UTC 其中UTC是统一标准世界时间. 完整的连接字符串示例:jdbc:mysql://localhost:3306/test?serverTime ...

随机推荐

  1. Redis数据结构常用命令

    Redis数据结构--字符串

  2. avue你繁琐的表格、表单、树等组件开发的解脱工具,了解一下?

    简介 Avue是基于Vue.js和element的快速开发框架 它的核心是数据驱动UI的思想,让我们从繁琐的crud开发中解脱出来,它的写法类似easyUI,但是写起来比easyui更容易,因为它是基 ...

  3. 【每日一包0012】to-camel-case,to-no-case,to-space-case

    github地址:https://github.com/ABCDdouyaer/a_pack_per_day_NO.1 to-camel-case 将被其他符号分割的字符串转换为驼峰形式的字符串 用法 ...

  4. Java常考面试题整理(四)

    有关所有Swing相关的面试题,都可以说是凑数的,感觉自己在敲这些的时候感觉一点用处都没有,可以从第72条开始看. 61.说出三种支持重绘(painting)的组件. 参考答案: Canvas,Fra ...

  5. LeetCode 2. 两数相加(Add Two Numbers)

    题目描述 给定两个非空链表来表示两个非负整数.位数按照逆序方式存储,它们的每个节点只存储单个数字.将两数相加返回一个新的链表. 你可以假设除了数字 0 之外,这两个数字都不会以零开头. 示例: 输入: ...

  6. html外部文件读取/写入

    1.文件的读取 外部文件读取控件: <input type="file" id="file_jquery" onchange="file_jqu ...

  7. JVM系列1:内存区域

    1.JVM运行区域内存划分 2.各内存区域详细介绍 2.1 程序计数器 程序计数器是一块很小的内存区域,它作为前线程所执行的字节码的行号指示器,指向当前class文件的执行代码的行数.字节码解释器工作 ...

  8. anaconda 安装pyspider出错

    注释Lib\mimetypes.py里面的 try:      mimetype = mimetype.encode(default_encoding) except UnicodeEncodeErr ...

  9. 改善EDM数据营销的关键点

    EDM数据营销有效增加潜在顾客.提升销售量,而成效得看你的邮件到达率.当点选发送后,邮件需要经过层层关卡才能够进入联络人收件箱,若是你的发送评级越好,邮件越容易进入收件箱.评级非常重要,它能够证明你是 ...

  10. New Date API介绍

    一.新的Date API介绍 LocalDateLocalTimeInstantDurationPeriod formatterparsejdk以前的java.util.Date存在的问题 1)比如n ...