I'm trying to connect MySQL by passing an IP address as a parameter instead of localhost.
Class.forName("com.mysql.jdbc.Driver");
try{
String url = "jdbc:mysql://192.168.1.116:3306/db";
DBConnection = DriverManager.getConnection(url, "root", "");
}
catch(Exception ex){ ex.printStackTrace(); }
The problem is the connection takes 1-2 minutes before showing this error.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
By the way, I'm using XAMPP.