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/