Connection con = null;
 try 
     Class.forName("com.mysql.jdbc.Driver");
     con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "");
  catch (Exception ex) 
     System.out.println(ex.getMessage());
return con;
Getting connection link failure message while running jar file from other windows to connect database to other system
 
    