0

my program refuses to connect to my mysql server when using my public ip, i've opened the port which it connects to and yet i still get some connection faliure.

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.

Here's the error message i get and below you can find the code for

Connection conn;
                String dbuser ="usrname";
                String dbpassw = "pass";
                String databaseName = "dbname";

                String url = "jdbc:mysql://"MY IP HERE":3306/"+databaseName;

                Class.forName("com.mysql.jdbc.Driver");
                conn = DriverManager.getConnection(url,dbuser,dbpassw);
                Statement st = conn.createStatement();

i used the ip you get from a whatsmyip site.

Janono
  • 161
  • 6
  • Can you connect to your database over this connection at all? What happens when you try a normal MySQL client? – David Oct 13 '16 at 17:10
  • well it connect perfectly when using "localhost" instead of the ip, i dont see why it shouldn't connect when using a normal client. But i can give it a try and reply the result @David – Janono Oct 13 '16 at 17:12
  • give that dupe target a whirl with opening it up to remote connections, a server daemon restart, examine your firewall, view the grants – Drew Oct 13 '16 at 17:19
  • @Janono Localhost and an external IP is like comparing your house to a house down the street. There's a lot of things you can do at your own house that you just can't do elsewhere. – Kayaman Oct 13 '16 at 17:20

0 Answers0