MySql jdbc driver unable to resolve hostname

java.net.UnknownHostException
Javadoc
Thrown to indicate that the IP address of a host could not be determined. @author Jonathan Payne @since JDK1.0
at java.net.Inet6AddressImpl.lookupAllHostAddr
(source)
at java.net.InetAddress$2.lookupAllHostAddr
at java.net.InetAddress.getAddressesFromNameService
(source)
at java.net.InetAddress.getAllByName0
(source)
at java.net.InetAddress.getAllByName
(source)
at java.net.InetAddress.getAllByName
(source)
at com.mysql.jdbc.StandardSocketFactory.connect
(source)
at com.mysql.jdbc.MysqlIO.<init>
(source)
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
Javadoc
An exception to represent communications errors with the database. Attempts to provide 'friendler' error messages to end-users, including last time a packet was sent to the database, what the client-timeout is set to, and whether the idle time has been exceeded.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0
(source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(source)
at java.lang.reflect.Constructor.newInstance
(source)
at com.mysql.jdbc.Util.handleNewInstance
(source)
at com.mysql.jdbc.SQLError.createCommunicationsException
(source)
at com.mysql.jdbc.MysqlIO.<init>
(source)
14 frames hidden

Typical Exception Messages

  1. 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.
  2. 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.
  3. 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.

Origin

NativeConstructorAccessorImpl.newInstance() has thrown a CommunicationsException

java.net.UnknownHostException
9 frames hidden
sun.reflect.NativeConstructorAccessorImpl.newInstance
3Web pages

Similar

Specific cases

Solution

rahsan, 1 month ago

There are quite a few reasons for this type of error. Please read this answer for more details.

External results for this pattern (3)

  1. dp00via GitHub4 months ago
    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.
    Show stack trace
  2. MrKiller01via GitHub1 year ago
    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.
    Show stack trace
  3. 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.
    Show stack trace