当前位置:网站首页>### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionExcep
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionExcep
2022-08-05 00:43:00 【阿水jackey】
一、我遇到的问题:
然后我就改了很多地方,结果都是一模一样的,报的都是无法连接数据库的错误,于是我就尝试性的修改了一下pom.xml配置文件里面的mysql依赖的版本就好了。
二、具体解决方案如下:
这是我原来的mysql依赖的版本:5.1.34 如下图

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>tomcat-demo0</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- tomcat 插件-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<!-- <configuration>
<port>80</port>
<path></path>
</configuration>-->
</plugin>
</plugins>
</build>
</project>
后来改成了:5.1.46 就可以连接上数据库了,图如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>tomcat-demo0</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- tomcat 插件-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<!-- <configuration>
<port>80</port>
<path></path>
</configuration>-->
</plugin>
</plugins>
</build>
</project>
如下图:

输入完用户名密码,就登录成功了

登录成功后的页面,如下图:

我改了很多地方都是一样的原因,但是多改多试,慢慢排查就好了,以上就是我这个问题的解决方案!希望可以帮助到你
边栏推荐
- CNI(Container Network Plugin)
- [230] Execute command error after connecting to Redis MISCONF Redis is configured to save RDB snapshots
- 软件测试面试题:软件测试类型都有哪些?
- The principle of NMS and its code realization
- Theory of Software Fundamentals
- 2022杭电多校第一场 1004 Ball
- 2022多校第二场 K题 Link with Bracket Sequence I
- 软件测试面试题:软件都有多少种分类?
- 2022 Hangzhou Electric Power Multi-School Session 3 Question B Boss Rush
- 2022 Hangzhou Electric Multi-School 1004 Ball
猜你喜欢

Countdown to 1 day!From August 2nd to 4th, I will talk with you about open source and employment!

面试汇总:为何大厂面试官总问 Framework 的底层原理?

node uses redis

软件基础的理论

【idea】idea配置sql格式化

Matlab uses plotting method for data simulation and simulation

gorm联表查询-实战

码率vs.分辨率,哪一个更重要?

redis可视化管理软件Redis Desktop Manager2022

could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
随机推荐
ORA-00257
OPENWIFI实践1:下载并编译SDRPi的HDL源码
2022 Nioke Multi-School Training Session H Question H Take the Elevator
Software Testing Interview Questions: What do test cases usually include?
软件测试面试题:关于自动化测试工具?
The principle of NMS and its code realization
2022 Multi-school Second Session K Question Link with Bracket Sequence I
tiup status
CNI(Container Network Plugin)
D - I Hate Non-integer Number (选数的计数dp
Matlab uses plotting method for data simulation and simulation
克服项目管理中恐惧心理
2022牛客多校训练第二场 J题 Link with Arithmetic Progression
二叉树[全解](C语言)
2022牛客多校训练第二场 L题 Link with Level Editor I
软件测试面试题:BIOS, Fat, IDE, Sata, SCSI, Ntfs windows NT?
Software Testing Interview Questions: What is Software Testing?The purpose and principle of software testing?
阶段性测试完成后,你进行缺陷分析了么?
Software Testing Interview Questions: What's the Key to a Good Test Plan?
B站7月榜单丨飞瓜数据B站UP主排行榜发布!