当前位置:网站首页>### 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: Please draw the seven-layer network structure diagram of OSI and the four-layer structure diagram of TCP/IP?
- 2022 Hangzhou Electric Multi-School Training Session 3 1009 Package Delivery
- 面试汇总:为何大厂面试官总问 Framework 的底层原理?
- Inter-process communication and inter-thread communication
- leetcode:266. 回文全排列
- Mysql_13 事务
- 4. PCIe 接口时序
- 主库预警日志报错ORA-00270
- 2022牛客多校第三场 J题 Journey
- 二叉树[全解](C语言)
猜你喜欢

Redis visual management software Redis Desktop Manager2022

node使用redis

oracle创建用户

JUC thread pool (1): FutureTask use

oracle create tablespace

leetcode:266. 回文全排列

"WEB Security Penetration Testing" (28) Burp Collaborator-dnslog out-band technology

【idea】idea配置sql格式化

Kubernetes 网络入门

could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
随机推荐
翁恺C语言程序设计网课笔记合集
TinyMCE禁用转义
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?
Software Testing Interview Questions: What is Software Testing?The purpose and principle of software testing?
Software Testing Interview Questions: What Are the Types of Software Testing?
Software testing interview questions: What stages should a complete set of tests consist of?
leetcode:266. 回文全排列
oracle创建表空间
Kubernetes 网络入门
2022牛客多校训练第二场 H题 Take the Elevator
【idea】idea配置sql格式化
Software test interview questions: BIOS, Fat, IDE, Sata, SCSI, Ntfs windows NT?
MBps与Mbps区别
3. pcie.v 文件
Software Testing Interview Questions: What do you think about software process improvement? Is there something that needs improvement in the enterprise you have worked for? What do you expect the idea
2022杭电多校训练第三场 1009 Package Delivery
软件测试面试题:一套完整的测试应该由哪些阶段组成?
TinyMCE disable escape
活动推荐 | 快手StreamLake品牌发布会,8月10日一起见证!
如何用 Solidity 创建一个“Hello World”智能合约