'Exception in thread "main" com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
Exception in thread "main" com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at [email protected]/com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) at [email protected]/com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) at [email protected]/com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:829) at [email protected]/com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:449) at [email protected]/com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:242) at [email protected]/com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at Jdbcconnection.main(Jdbcconnection.java:13) Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) at [email protected]/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at [email protected]/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) at [email protected]/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) at [email protected]/com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) at [email protected]/com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) at [email protected]/com.mysql.cj.NativeSession.connect(NativeSession.java:120) at [email protected]/com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:949) at [email protected]/com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:819) ... 6 more Caused by: java.net.UnknownHostException: No such host is known (localhost;3306) at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:933) at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1519) at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852) at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1509) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1367) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1301) at [email protected]/com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:133) at [email protected]/com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ... 9 more
Can anyone help me please.enter image description here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|