I'm doing a Java project where it needs to connect it to a database. but there's the problem is when I run my code it shows me the exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Here is my code:
public Connection cc;
public Statement stm;
public ResultSet rr;
public void Class() {
try {
Class.forName("com.mysql.jdbc.Driver");
cc = DriverManager.getConnection("jdbc:mysql://69.89.31.241:2083/table", "user", "pass");
JOptionPane.showMessageDialog(null, "Connection Ok");
} catch (Exception e) {
System.out.println(e);
}
}
Now if I try this way in localhost it works but not on my live server. My server is Server: Localhost via UNIX socket.