java.net.ConnectException: Connection Refused
Posted by: Brian Tusi
Date: July 03, 2005 12:23PM

Hello all,

I've begun developing a Java app that connects to a MySQL database via JDBC. Earlier, I had the app connecting to a Linux box running an older version of MySQL, 4.0.12, I believe (4.0.x). Everything was working fine.

I've since installed MySQL 4.1.12 on my local Mac, which I've been developing on. However, I'm getting a Connection Refused error when I try to connect to the local MySQL. Note that the code has not changed from when it was working before. I'm able to access the database via a local PHPMyAdmin, and I'm also able to get a prompt via telnet from another machine on the LAN, so a firewall is not the issue. Any ideas? I've seen a pretty lengthy post on this topic here before, but those apply to Mandrake/Mandriva, and from what I understand, the OS X version of MySQL does not have a my.cnf (nor can I find one) by default.

Error output from Java:

Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused

STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection refused
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:151)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1774)
at com.mysql.jdbc.Connection.<init>(Connection.java:437)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:268)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at com.bt.search.Database.<init>(Database.java:18)
at com.bt.search.Search.main(Search.java:18)


** END NESTED EXCEPTION **

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.