java.net.ConnectException: connection refused
Posted by: Gavin Maxwell
Date: May 04, 2005 08:30AM

I am running SuSE 9.2 and am using the connector included (mysql-connector-java-3.0.11.jar), as well as tomcat5 and mysql 4.0.21 (both included).

When I try to connect to my database from a servlet I get the error:

SQL Exception ! connect to the database
Sql State: 08S01 Error code: 0

- Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused

com.mysql.jdbc.Connection in createNewIO (line 1719 in Connection.java)
com.mysql.jdbc.Connection in (line 432 in Connection.java)
com.mysql.jdbc.NonRegisteringDriver in connect (line 400 in NonRegisteringDriver.java)
java.sql.DriverManager in getConnection (line 512 in DriverManager.java)
java.sql.DriverManager in getConnection (line 171 in DriverManager.java)
Database: cannot initialise the connectionSQL Exception ! connect to the database
Sql State: 08S01 Error code: 0

I have checked my.cnf and skip-networking is commented out, so this shouldn't be a problem. I have also checked /etc/hosts and localhost is mapped to 127.0.0.1. What could be wrong? I can connect using Query Browser etc., from a remote machine, and from the command line, so it must be a JDBC issue.

Any help would be greatly appreciated.

Options: ReplyQuote


Subject
Written By
Posted
java.net.ConnectException: connection refused
May 04, 2005 08:30AM


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.