java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused: connect

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Oracle Community by 807595, 1 year ago
Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused: connect
via Oracle Community by 843854, 1 year ago
Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused
via xplanner by jpmigue
, 1 year ago
Server connection failure during transaction. Due to underlying exception: 'java.net.ConnectException: Connection refused'.      \[java\] Attempted reconnect 3 times. Giving up.
via Oracle Community by 361171, 10 months ago
Unable to connect to any hosts due to exception: java.lang.NullPointerException
via Oracle Community by 843859, 5 months ago
Unable to connect to any hosts due to exception: java.lang.ArrayIndexOutOfBoundsException: 40
via Google Groups by Daniel Wieneck, 3 months ago
Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused
java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused: connect
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1797)
at com.mysql.jdbc.Connection.(Connection.java:562)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:361)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at undefined.bd.main(bd.java:12)

Users with the same issue

You are the first who have seen this exception.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.