当前位置:网站首页>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>
边栏推荐
- Example of using QPushButton style (and method of adding drop-down menu to button SetMenu)
- 一些基本错误
- Wechat applet uniapp left slide delete with Delete Icon
- Button how to dynamically set drawablebottom (setcomposunddrawables is invalid)
- Redis single sign on system + voting system
- Numpy之matplotlib
- The goal you specified requires a project to execute but there is no POM
- Using cache in vuex to solve the problem of data loss in refreshing state
- Feign remote call
- [recommended collection] these 8 common missing value filling skills must be mastered
猜你喜欢

Logstash安装及使用

Wechat applet uniapp left slide delete with Delete Icon

Basic and necessary common plug-ins of vscade

Unit test of boot

Crawl Douban to read top250 and import it into SqList database (or excel table)

Deep learning: numpy

Leetcode interview question 29 clockwise print matrix

Minimum spanning tree, shortest path, topology sorting, critical path

商品秒杀系统

When does the mobile phone video roll off?
随机推荐
抖音实战~分享模块~短视频下载(保存到相册)
Boot指标监测
关于Qt数据库开发的一些冷知识
Basic and necessary common plug-ins of vscade
Using cache in vuex to solve the problem of data loss in refreshing state
On the escape of inequality value
Kubernetes resource topology aware scheduling optimization
【Mysql系列】工作常用sql集锦(持续更新)
Tiktok practice ~ sharing module ~ generate short video QR code
Interview key points that must be mastered index and affairs (with B-tree and b+ tree)
数据库SQL语句撰写
The king of Internet of things protocol: mqtt
[kubernetes] kubernetes principle analysis and practical application (under update)
The goal you specified requires a project to execute but there is no POM
Handwritten numeral recognition based on tensorflow
Convex hull problem
Project practice 4: user login and token access verification (reids+jwt)
【Kubernetes】Kubernetes 原理剖析与实战应用(更新中)
自己创建一个时间拦截器
Installation and use of logstash