tags:

views:

33

answers:

1

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

With the following cause:

Caused by: java.net.ConnectException: Connection refused

Naturally, my next step was to test the port that mysql was attempting to connect on (3306).

$ telnet localhost 3306 
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

My next step was to see if port 3306 was listening at all.

$ netstat -an|grep 3306
tcp        0      0 69.164.214.18:3306      0.0.0.0:*               LISTEN

So in summary, the port is listening but not accepting connections? I must admit, I do not know a whole lot about this, but does anybody know what is going on here?

A: 

I figured it out. I needed to connect to mysql externally, but my program was trying to access it locally.

Walker Holahan