一.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. 将Bean转换为Json形式的一个工具类

    这边遇到一个问题:  1.做一个bean类,实现一个函数,能够把bean生成json字符串.按字段作为key,字段值作为value的方式生成,并且按key的ascii码的升序生成.     2.提示: ...

  2. 编译一个需要用特定key前面的应用程序

    LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Build all java files in the java subdirectory L ...

  3. hibernate entitymanager的理解

    hibernate EntityManager是围绕提供JPA编程接口的Hibernate Core的一个包装,支持JPA实体实例的生命周期,并允许你用标准的JavaPersistence查询语言编写 ...

  4. MSO Transponder 页面开发思路

    1. 确定Transponder开发页面分类,定义负责模块 2. 定义模块页面布局 3. 选择页面各数据对应的控件类型 4. 选定控件对应set/get所用方式 快捷键链接设置: http://www ...

  5. UIButton设置按钮点击范围大于可视范围

    自定义按钮类型CustomButton,继承UIButton,重写pointInside函数改变点击响应范围. 例如,按钮点击范围比实际高度上下增加6. CustomButton.h @interfa ...

  6. [Java]算术表达式求值之一(中序表达式转后序表达式方案)

    第二版请见:https://www.cnblogs.com/xiandedanteng/p/11451359.html 入口类,这个类的主要用途是粗筛用户输入的算术表达式: package com.h ...

  7. NMS(非极大值抑制算法)

    目的:为了消除多余的框,找到最佳的物体检测的位置 思想: 选取那些领域里分数最高的窗口,同时抑制那些分数低的窗口 Soft-NMS

  8. 浏览器端-W3School-JavaScript:JavaScript Math 对象

    ylbtech-浏览器端-W3School-JavaScript:JavaScript Math 对象 1.返回顶部 1. Math 对象 Math 对象用于执行数学任务. 使用 Math 的属性和方 ...

  9. 浏览器端-3WSchool-JavaScript:JavaScript Boolean 对象

    ylbtech-浏览器端-3WSchool-JavaScript:JavaScript Boolean 对象 1.返回顶部 1. Boolean 对象 Boolean 对象表示两个值:"tr ...

  10. Android EditText弹出软键盘实现页面标题头不动,软键盘弹出在编辑框下面

    为了实现EditText编辑的时候弹出软键盘标题头不动,底部编辑框,上移在这总结: RelativeLayout在弹出软键盘的时候先寻找android:layout_alignParentBottom ...