我的程序在使用我的公共IP时拒绝连接到我的mysql服务器,我打开了它所连接的端口,但我仍然得到了一些连接功能。
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.
这是我得到的错误消息,您可以在下面找到
的代码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();
我使用了你从whatsmyip网站获得的ip。