I can not connect to database , which is stored on the hosting.
An error appears:
error: com.mysql.jdbc.exceptions.jdbc4.communicationSException: Communications Link Failure
And when connected to the database that is on my computer everything works:
The Last Packet Sent SuccessFully To The Server Was 0 Milliseconds Ago. The Driver Has Not Received Any Packets from The Server.
The assembly has been successfully completed (total time: 17 seconds)
package mysql;
Import java.sql. *;
Public Class Dbconnect {
Private Connection CON;
Private statement st;
Private ResultSet RS;
Public dbconnect () {
Try {
Class.Forname ("com.mysql.jdbc.driver");
CON = DRIVERMANAGER.GETCONNECTION ("JDBC: mysql: //mysql.hostinger.ru: 3306 / u740438416_test", "u740438416_asd", "asdasd");
} Catch (Exception EX) {
System.out.PrintLN ("Error:" + EX);
}
}
}
Answer 1, Authority 100%
Causes of the Communications Link Failure
error can be a lot. The bottom line is that JDBC cannot connect to this database. Check the database data: URL, port, server server with database, database settings, Firewall your / on the server and other