当前位置:网站首页>### 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>
如下图:
输入完用户名密码,就登录成功了
登录成功后的页面,如下图:
我改了很多地方都是一样的原因,但是多改多试,慢慢排查就好了,以上就是我这个问题的解决方案!希望可以帮助到你
边栏推荐
- Software Testing Interview Questions: What aspects should be considered when designing test cases, i.e. what aspects should different test cases test against?
- 【Unity编译器扩展之进度条】
- [230] Execute command error after connecting to Redis MISCONF Redis is configured to save RDB snapshots
- BC(转)[js]js计算两个时间相差天数
- 阶段性测试完成后,你进行缺陷分析了么?
- Kubernetes 网络入门
- 软件测试面试题:软件测试类型都有哪些?
- Software testing interview questions: the difference and connection between black box testing, white box testing, and unit testing, integration testing, system testing, and acceptance testing?
- Redis visual management software Redis Desktop Manager2022
- 活动推荐 | 快手StreamLake品牌发布会,8月10日一起见证!
猜你喜欢
Countdown to 1 day!From August 2nd to 4th, I will talk with you about open source and employment!
Lattice PCIe 学习 1
[idea] idea configures sql formatting
SV class virtual method of polymorphism
2022 Hangzhou Electric Power Multi-School Session 3 K Question Taxi
node uses redis
电赛必备技能___定时ADC+DMA+串口通信
Mysql_13 事务
DHCP的工作过程
OPENWIFI实践1:下载并编译SDRPi的HDL源码
随机推荐
oracle创建用户以后的权限问题
tiup uninstall
Theory of Software Fundamentals
Raw and scan of gorm
软件测试面试题:软件都有多少种分类?
Helm Chart
2022多校第二场 K题 Link with Bracket Sequence I
《WEB安全渗透测试》(28)Burp Collaborator-dnslog外带技术
"WEB Security Penetration Testing" (28) Burp Collaborator-dnslog out-band technology
[230] Execute command error after connecting to Redis MISCONF Redis is configured to save RDB snapshots
2022 Hangzhou Electric Power Multi-School Session 3 K Question Taxi
活动推荐 | 快手StreamLake品牌发布会,8月10日一起见证!
E - Many Operations (按位考虑 + dp思想记录操作后的结果
软件测试面试题:软件测试类型都有哪些?
Opencv——视频跳帧处理
2022杭电多校第三场 L题 Two Permutations
oracle create user
ora-00604 ora-02429
软件测试面试题:负载测试、容量测试、强度测试的区别?
node使用redis