The Java application I am working with is supposed to write its resulting data to a mysql database, but whenever I run it, I get the following exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Caused by: java.net.ConnectException: Connection refused
$ telnet localhost 3306
telnet: Unable to connect to remote host: Connection refused
$ netstat -an|grep 3306
tcp 0 0 126.96.36.199:3306 0.0.0.0:* LISTEN
I figured it out. I needed to connect to mysql externally, but my program was trying to access it locally.