Re: Communications link failure
Posted by: Todd Farmer
Date: August 15, 2012 05:25PM

Hi Dionisio,

OK, what does the following code produce when you execute it:

try {
Socket socket = new Socket("localhost", 3306);
BufferedReader r = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
int c = 0;
while ((c = r.read()) != -1)
System.out.print((char) c);
socket.close();
} catch (Exception e) {
e.printStackTrace();
}

If the server is accessible on localhost:3306, you should see the server handshake packet (it will contain the server version and a binary encryption seed for the session). If it can't get there (firewall, anti-virus, server not running, whatever), you'll get an Exception:

java.net.ConnectException: Connection refused: connect
...

If you get an exception, you're going to need to dig into the peculiarities of your deployment environment to understand why Java can't connect over TCP to the mysqld instance on the same machine.

Hope that helps!

--
Todd Farmer
MySQL @ Oracle
http://www.oracle.com/mysql/

Options: ReplyQuote


Subject
Written By
Posted
Re: Communications link failure
August 15, 2012 05:25PM
November 27, 2012 08:23AM
November 27, 2012 11:18AM
January 06, 2013 01:46PM
January 08, 2013 04:25PM
January 08, 2013 11:11PM
January 09, 2013 10:36AM
January 10, 2013 08:23AM
January 18, 2013 02:02PM
September 23, 2012 02:03PM


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.