一.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. C++入门经典-例6.10-将多维数组转换成一维数组

    1:代码如下: // 6.10.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> usin ...

  2. Spring Data JPA的Respository接口中查询方法

  3. 第五次实验报告&学习总结

    一.实验目的 (1) 理解抽象类与接口的使用; (2)了 解包的作用,掌握包的设计方法. 二.实验要求 (1)掌 握使用抽象类的方法. (2)掌 握使用系统接口的技术和创建自定义接口的方法. (3) ...

  4. 排序算法(C++)

    冒泡排序.选择排序.快速排序.插入排序.希尔排序.归并排序.基数排序.堆排序. 推荐网址1:https://www.cnblogs.com/onepixel/articles/7674659.html ...

  5. CentOS7 一个网卡配置多个IP地址

    1.给网卡p8p1新创建配置文件(复制原来的p8p1,修改IP地址即可) ifcfg-p8p1:0 vim  /etc/sysconfig/network-scripts/ifcfg-p8p1:0 D ...

  6. 微信、QQ第三方登录授权时的问题总结

    一.微信第一个问题:redirect_uri域名与后台配置不一致,错误码:10003 解决方案: 1,首先确定访问的第三方接口地址参数前后顺序是否正确,redirect_uri回调地址是否加了http ...

  7. out 传值(传址)

    传值,只将这个变量的值给拿走,不返还,除非return赋值.将a的值传入函数,无论这个值在函数中如何变化,不会影响main中的a 传址,将这个变量的值拿走运算,完成后还是得返还回来(不用return, ...

  8. assert断言用法

    使用assert断言是学习python一个非常好的习惯,python assert 断言句语格式及用法很简单.在没完善一个程序之前,我们不知道程序在哪里会出错,与其让它在运行最崩溃,不如在出现错误条件 ...

  9. 内网IPC$入侵

    一.域操作相关的命令1.查看域用户 net user/domain2.查看有几个域 net view/domain3.查看域内的主机 net view/domain: XXX4.查看域里面的组 net ...

  10. 阶段3 3.SpringMVC·_01.SpringMVC概述及入门案例_04.入门程序之搭建开发环境

    选择骨架构建 默认选中next-然后finish后就会去网上下载插件.会比较耗费时间. 添加一组键值对: archetypeCatalog internal 添加了这组坚持对,就可以解决Mavn项目创 ...