当前位置:网站首页>Solve com mysql. jdbc. exceptions. jdbc4.MySQLNonTransientConnectionException: Could not create connection
Solve com mysql. jdbc. exceptions. jdbc4.MySQLNonTransientConnectionException: Could not create connection
2022-06-26 19:11:00 【Teng Qingshan】
Abnormal information
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1023)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2407)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2328)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.company.Main.main(Main.java:11)
Caused by: java.lang.NullPointerException
at com.mysql.jdbc.ConnectionImpl.getServerCharacterEncoding(ConnectionImpl.java:3309)
at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1985)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1911)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1288)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2508)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2346)
... 13 more
The reason for the error is that I used mysql-connector-java The version is 5, The database version is 8.
The solution is to modify pom.xml In file mysql-connector-java Version of :
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>
边栏推荐
- Installation and use of filebeat
- 威胁猎人必备的六个威胁追踪工具
- 抖音实战~分享模块~复制短视频链接
- Web resource preloading - production environment practice
- PC end records 515 ground sweeping robot /scan data
- The goal you specified requires a project to execute but there is no POM
- 抖音实战~分享模块~生成短视频二维码
- Preliminary analysis of serial port printing and stack for arm bare board debugging
- Wechat applet uniapp left slide delete with Delete Icon
- 商品秒杀系统
猜你喜欢

Leetcode interview question 29 clockwise print matrix

Minimum spanning tree, shortest path, topology sorting, critical path
![[recommended collection] these 8 common missing value filling skills must be mastered](/img/ab/353f74ad73ca592a3f97ea478922d9.png)
[recommended collection] these 8 common missing value filling skills must be mastered

Feign远程调用

数据库范式和主码的选择

Decompilation of zero time technology smart contract security series articles

抖音实战~分享模块~生成短视频二维码

Numpy's Matplotlib

微服务版单点登陆系统(SSO)

Tiktok practice ~ sharing module ~ generate short video QR code
随机推荐
Redis单点登陆系统+投票系统
读书笔记:《过程咨询 III》
Micro service single sign on system (SSO)
Button how to dynamically set drawablebottom (setcomposunddrawables is invalid)
50行代码爬取Top500图书导入TXT文档
Invocation failed Unexpected end of file from server
Feign远程调用
Redis Basics
Vscode 基础必备 常用插件
String string is converted to jsonarray and parsed
To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
Project practice 5: build elk log collection system
Determine whether a sequence is a stack pop-up sequence
ROS query topic specific content common instructions
[MySQL series] collection of common working SQL (continuous update)
Boot indicator monitoring
抖音实战~分享模块~复制短视频链接
Yujun product methodology
Union, intersection and difference operations in SQL
Analysis on development technology of NFT meta universe chain game system