当前位置:网站首页>### 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>
如下图:

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

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

我改了很多地方都是一样的原因,但是多改多试,慢慢排查就好了,以上就是我这个问题的解决方案!希望可以帮助到你
边栏推荐
- About I double-checked and reviewed the About staff page, returning an industry question
- D - I Hate Non-integer Number (count of selected number dp
- 电赛必备技能___定时ADC+DMA+串口通信
- tiup status
- 3. pcie.v 文件
- Theory of Software Fundamentals
- 2022杭电多校第三场 K题 Taxi
- tiup telemetry
- 翁恺C语言程序设计网课笔记合集
- The method of freely controlling concurrency in the sync package in GO
猜你喜欢

could not build server_names_hash, you should increase server_names_hash_bucket_size: 32

SV 类的虚方法 多态

gorm联表查询-实战

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

OPENWIFI实践1:下载并编译SDRPi的HDL源码

Redis visual management software Redis Desktop Manager2022

gorm joint table query - actual combat

JUC thread pool (1): FutureTask use

oracle create tablespace

SV class virtual method of polymorphism
随机推荐
Matlab uses plotting method for data simulation and simulation
The principle of NMS and its code realization
Software testing interview questions: What are the seven-layer network protocols?
[idea] idea configures sql formatting
D - I Hate Non-integer Number (count of selected number dp
E - Many Operations (按位考虑 + dp思想记录操作后的结果
oracle创建用户
GCC:编译时库路径和运行时库路径
Software testing interview questions: test life cycle, the test process is divided into several stages, and the meaning of each stage and the method used?
E - Distance Sequence (prefix and optimized dp
"No title"
Pytorch使用和技巧
About I double-checked and reviewed the About staff page, returning an industry question
Software Testing Interview Questions: What is Software Testing?The purpose and principle of software testing?
matlab 采用描点法进行数据模拟和仿真
node使用redis
2022 Hangzhou Electric Multi-School 1004 Ball
Zombie and orphan processes
2022 Hangzhou Electric Power Multi-School Session 3 Question B Boss Rush
软件测试面试题:软件都有多少种分类?