com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure

My program that connects to a MySQL database was working fine. Then, without changing any code used to set up the connection, I get this exception: com.mysql.jdbc.exceptions.jdbc4.