I am having problems connecting to my database, here is the connection class
public class DBConnect
{
public static Connection getDBConnect() throws Exception
{
String x = "worked";
//String url = "jdbc:mysql://mysql8.secureserver.net";
String url = "jdbc:mysql://mysql13.secureserver.net/DBName?user=User&password=Password";
System.out.println("Before driver load");
try
{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver Loaded");
}
catch(java.lang.ClassNotFoundException e)
{
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
System.out.println("After driver loaded and Before connect");
Connection con = DriverManager.getConnection(url);
System.out.println("Tried connect");
return con;
}
}
here is the error:
INFO: Server startup in 17685 ms
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection timed out: connect
STACKTRACE:
java.net.SocketException: java.net.ConnectException: Connection timed out: connect
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:151)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1765).....