当前位置:网站首页>### 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>
如下图:
输入完用户名密码,就登录成功了
登录成功后的页面,如下图:
我改了很多地方都是一样的原因,但是多改多试,慢慢排查就好了,以上就是我这个问题的解决方案!希望可以帮助到你
边栏推荐
- 软件测试面试题:软件都有多少种分类?
- gorm联表查询-实战
- Software Testing Interview Questions: What aspects should be considered when designing test cases, i.e. what aspects should different test cases test against?
- Software testing interview questions: How many types of software are there?
- 软件测试面试题:手工测试与自动测试有哪些区别?
- 软件测试面试题:软件测试类型都有哪些?
- NMS原理及其代码实现
- 软件测试面试题:一套完整的测试应该由哪些阶段组成?
- 【FreeRTOS】FreeRTOS与stm32内置堆栈的占用情况
- 3. pcie.v 文件
猜你喜欢
随机推荐
主库预警日志报错ORA-00270
面试汇总:为何大厂面试官总问 Framework 的底层原理?
could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
2022牛客多校训练第二场 J题 Link with Arithmetic Progression
[FreeRTOS] FreeRTOS and stm32 built-in stack occupancy
oracle创建用户
leetcode:266. 回文全排列
2022牛客多校第三场 J题 Journey
Software testing interview questions: What are the seven-layer network protocols?
【FreeRTOS】FreeRTOS与stm32内置堆栈的占用情况
2022 Hangzhou Electric Power Multi-School Session 3 Question B Boss Rush
node uses redis
ora-00604 ora-02429
leetcode: 267. Palindromic permutations II
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?
Zombie and orphan processes
2022多校第二场 K题 Link with Bracket Sequence I
Pytorch使用和技巧
二叉树[全解](C语言)
软件测试面试题:网络七层协仪具体?