List:MySQL and Java« Previous MessageNext Message »
From:Michael Stabler Date:May 13 2005 4:03pm
Subject:RE: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
View as plain text  
In that case, I would definitely closely examine the values being passed to
your URL from your properties. My guess would be there is something in your
URL specific to Windows that is making the Connector say "Hey, I can't read
this!"

Perhaps perform a simpler test first? Try something like

Properties myProps = new Properties( )
// add user/password to myProps.

DriverManager.getConnection([FULL_URL_AS_HAND_TYPED_STRING], myProps);

or, if you temporarily grant full access to your DB, even run it without any
props, to see what happens:

DriverManager.getConnection([FULL_URL_AS_HAND_TYPED_STRING]);

If it still doesn't work then, you should start looking at your MySQL
config.

Good luck!

Michael Stabler

-----Original Message-----
From: emorales@stripped [mailto:emorales@stripped] 
Sent: Friday, May 13, 2005 10:01 AM
To: java@stripped
Subject: Re: com.mysql.jdbc.CommunicationsException: Communications link
failure due to underlying exception:

Yes Michael,

I fact I forgot to mention this, but the application (which is throwing the 
exception) runs perfectly in Linux... is the Windows XP service pack 2 
machine I'm having troubles to connect from (I've not made any test in other

windows versions).

Is there any chance the problem is XP's SP2?

On Friday 13 May 2005 08:48, Michael Stabler wrote:
> Gonna sound silly, but just to make sure...
>
>     Did you register the Connector first?
>
> 	Class.forName("com.mysql.jdbc.Driver");
>
> Michael Stabler
> -----Original Message-----
> From: emorales@stripped [mailto:emorales@stripped]
> Sent: Friday, May 13, 2005 9:14 AM
> To: java@stripped
> Subject: com.mysql.jdbc.CommunicationsException: Communications link
> failure due to underlying exception:
>
> Hi,
> I have a problem connecting from JDBC in Windows, when I try to execute:
> conn = DriverManager.getConnection("jdbc:mysql://"
>                                 + pref.getProperty("dbms.host")
>                                 + ":" + pref.getProperty("dbms.port")
>                                 + "/" + pref.getProperty("dbms.sid")
>                                 + "?user=" + user + "&password=" +
> pwd.toString()
>                                 + "&autoReconnect=true");
>
> I get this exception:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> com.mysql.jdbc.CommunicationsException: Communications link failure due to
> under
> lying exception:
>
> ** BEGIN NESTED EXCEPTION **
>
> java.io.EOFException
>
> STACKTRACE:
>
> java.io.EOFException
>         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1895)
>         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2342)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2838)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:773)
>         at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3612)
>         at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1204)
>         at com.mysql.jdbc.Connection.createNewIO(Connection.java:1699)
>         at com.mysql.jdbc.Connection.<init>(Connection.java:408)
>         at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
>
> :270)
>
>         at java.sql.DriverManager.getConnection(Unknown Source)
>         at java.sql.DriverManager.getConnection(Unknown Source)
>         at bb.db.Connection.<init>(Connection.java:71)
>         at bb.Main.<init>(Main.java:34)
>         at bb.Main.createAndShowMainFrame(Main.java:71)
>         at bb.Main$1.run(Main.java:105)
>         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
>         at java.awt.EventQueue.dispatchEvent(Unknown Source)
>         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
> Source)
>
>         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
> Source)
>         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>         at java.awt.EventDispatchThread.run(Unknown Source)
>
>
> ** END NESTED EXCEPTION **
>
>
>         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2554)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2838)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:773)
>         at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3612)
>         at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1204)
>         at com.mysql.jdbc.Connection.createNewIO(Connection.java:1699)
>         at com.mysql.jdbc.Connection.<init>(Connection.java:408)
>         at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
>
> :270)
>
>         at java.sql.DriverManager.getConnection(Unknown Source)
>         at java.sql.DriverManager.getConnection(Unknown Source)
>         at bb.db.Connection.<init>(Connection.java:71)
>         at bb.Main.<init>(Main.java:34)
>         at bb.Main.createAndShowMainFrame(Main.java:71)
>         at bb.Main$1.run(Main.java:105)
>         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
>         at java.awt.EventQueue.dispatchEvent(Unknown Source)
>         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
> Source)
>
>         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
> Source)
>         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>         at java.awt.EventDispatchThread.run(Unknown Source)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> I saw this thread:
>
> http://forums.mysql.com/read.php?39,16257,16257#msg-16257
>
> in the forums... but any of the proposed solutions there apply to my case
> since I try connecting from the same windows machine using MySQL
> Administrator and I can get a connection from it...
>
> The java version used for the application is:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> $ java -version
> java version "1.5.0_03"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
> Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> And MySQL's J/Connector version is: mysql-connector-java-3.1.8-bin.jar
>
> I'm connecting to a MySQL server:
> mysql  Ver 14.9 Distrib 5.0.3-beta, for portbld-freebsd5.3 (i386)
>
> Is there a bug or any in J/Connector or something like that? (I've already
> tryed with J/Connector versions 3.0 or 3.2 but neither correct the
> problem..
>
> Thanks a lot in advance for any help.
> Regards,
>
> Ed.
>
> --
> MySQL Java Mailing List
> For list archives: http://lists.mysql.com/java
> To unsubscribe:    http://lists.mysql.com/java?unsub=1

-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/java?unsub=1


Thread
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:emorales13 May
  • RE: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:Michael Stabler13 May
Re: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:emorales13 May
  • RE: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:Michael Stabler13 May