You Have to try this code..
try{
Class.forName(DRIVER);
connection = DriverManager.getConnection("jdbc:mysql://localhost/db_name",root,password);
}catch(Exception ex){
JOptionPane.showMessageDialog(null, ex.getMessage(),"Unable to connect",JOptionPane.ERROR_MESSAGE);
}
this code for the client
try{
Class.forName(DRIVER);
connection = DriverManager.getConnection("jdbc:mysql://169.254.214.132",client_name,password);
}catch(Exception ex){
JOptionPane.showMessageDialog(null, ex.getMessage(),"Unable to connect",JOptionPane.ERROR_MESSAGE);
}