当前位置: 首页 >数据库 > 原创:mysql5 还原至mysql 8.0.11数据库链接配置提示错误(修改内容有三处

原创:mysql5 还原至mysql 8.0.11数据库链接配置提示错误(修改内容有三处

原创:mysql5 还原至mysql 8.0.11数据库链接配置提示错误改有三:

 a) mysql 连接jar包版修改 b)类路径修改 c)配置连接池地址修改

 

因版本升级,首先要修改

1:mysql-connector-java 架包版本修改

<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId>
        !--原版本 5.1.6--><version>8.0.11</version></dependency>

 

 

2:因架包升级至mysql8.0.11

 mybatis的配置文件applicationContext-dao.xml

中有两处修改

 a): 修改类路径 :
处理:提示信息表明数据库驱动com.mysql.jdbc.Driver'已经被弃用了、应当使用新的驱动com.mysql.cj.jdbc.Driver'
<property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>

 a): 加接地址url :
<property name="url" value="jdbc:mysql://localhost:3306/maven?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;useSSL=false"/>

所以,按照提示更改jdbc.properties配置 .com.mysql.jdbc.Driver  改为  com.mysql.cj.jdbc.Driver

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsd"><!--dao层配置文件开始--><!--配置连接池--><bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"><!--<property name="driverClassName" value="com.mysql.jdbc.Driver"/>--><property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/maven?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;useSSL=false"/><property name="useame" value="root"/><property name="password" value="root"/></bean><!--配置生产SqlSession对象的工厂--><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource"/><!--扫描pojo包,给包下所有pojo对象起别名--><property name="typeAliasesPackage" value="com.itheima.domain"/></bean><!--扫描接口包路径,生成包下所有接口的代理对象,并且放入spring容器中--><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="com.itheima.dao"/></bean><!--dao层配置文件结束--></beans>

 

作者:码哥之旅
来源链接:https://www.cnblogs.com/asplover/p/12347994.html

版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaclub.cn/database/117530.html

标签:MySQL升级
分享给朋友:

“原创:mysql5 还原至mysql 8.0.11数据库链接配置提示错误(修改内容有三处” 的相关文章