Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: Communications link failure due to underlying exception


Advanced Search

Re: Communications link failure due to underlying exception
Posted by: Jeff Smith ()
Date: May 23, 2007 04:29PM

I was running this block of code in a loop (100 times) and it worked sometimes and failed sometimes under MySQL. Under HSQL, it always succeeds.

java.sql.PreparedStatement stmt = con.prepareStatement(
"SELECT MODEL_TASK_TYPE_ID FROM MODEL_TASK_TYPE " +
"WHERE MODEL_TASK_TYPE=? AND MODEL_TYPE=? AND USER_ID=? AND COMPUTER_ID=?");
stmt.setString(1, taskName);
stmt.setString(2, modelType);
stmt.setInt(3, userID);
stmt.setInt(4, computerID);
java.sql.ResultSet rs = stmt.executeQuery();

I got the same error a lot of you did:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException

Two Clues To The Problem:
------------------------
1) The simple select statement above always succeeded when I set a parameter to a value that would match NO rows. For example, if I set the COMPUTER_ID to 9999, I never got an exception.
2) The simple select always succeeded when I dropped a unique constraint on 4 of the columns in the table. No constraint = works.

For now, my hack solution is to leave off the unique key (I still have the foreign keys defined).

Given my clues, it seems to me that the bug lies in MySQL version 5.0.15, not in the Connector/J JDBC driver. I may ask my SysAd to install the latest version to see if that fixes the problem. By the way, I've tried all the versions of the JDBC driver--it makes no difference.

MySQL 5.0.15 under Linux
Java 5 running under Windows
MySQL Connector/J 5.06

I hope this helps someone.

-Jeff

------------ UPDATE ON MAY 24, 2007 ---------------

I updated MySQL to version 5.0.41 and the problem went away.



Edited 2 time(s). Last edit at 05/24/2007 05:01PM by Jeff Smith.

Options: ReplyQuote


Subject Written By Posted
Communications link failure due to underlying exception Henry Fernandes 02/22/2005 01:11AM
Re: Communications link failure due to underlying exception Tetsuro Ikeda 02/22/2005 02:54AM
Re: Communications link failure due to underlying exception Henry Fernandes 02/22/2005 10:38AM
Re: Communications link failure due to underlying exception Henry Fernandes 02/22/2005 11:48AM
Re: Communications link failure due to underlying exception (My Solution) niyi oladeji 11/01/2007 09:32AM
Re: Communications link failure due to underlying exception Marcelo Chryssovergis 04/15/2005 02:32PM
Re: Communications link failure due to underlying exception Carlos Martins 04/20/2005 08:00AM
Re: Communications link failure due to underlying exception Raed Kuhail 05/15/2005 02:48AM
Re: Communications link failure due to underlying exception Michael Carell 06/02/2005 05:06AM
Re: Communications link failure due to underlying exception Alper Akture 07/11/2005 07:27PM
Re: Communications link failure due to underlying exception Peter Andrews 07/15/2005 08:52AM
Re: Communications link failure due to underlying exception Peter Andrews 07/15/2005 11:49AM
Re: Communications link failure due to underlying exception Peter Andrews 07/15/2005 03:22PM
Re: Communications link failure due to underlying exception Peter Andrews 07/19/2005 06:24AM
Re: Communications link failure due to underlying exception Mark Matthews 07/19/2005 07:41AM
Re: Communications link failure due to underlying exception Alper Akture 07/20/2005 12:03PM
Re: Communications link failure due to underlying exception Mark Matthews 07/20/2005 12:06PM
Re: Communications link failure due to underlying exception Alper Akture 07/20/2005 02:06PM
Re: Communications link failure due to underlying exception Mark Matthews 07/20/2005 02:08PM
Re: Communications link failure due to underlying exception Alper Akture 07/20/2005 02:36PM
Re: Communications link failure due to underlying exception Peter Andrews 08/03/2005 08:48AM
Re: Communications link failure due to underlying exception suma latha 03/10/2007 02:23AM
Re: Communications link failure due to underlying exception Mark Matthews 07/19/2005 07:34AM
Re: Communications link failure due to underlying exception YoungSung Lee 06/08/2007 02:09AM
Re: Communications link failure due to underlying exception M Jersan 06/13/2005 04:36AM
Re: Communications link failure due to underlying exception Alper Akture 07/20/2005 04:44PM
Re: Communications link failure due to underlying exception Mark Matthews 07/20/2005 06:03PM
Re: Communications link failure due to underlying exception Alper Akture 07/21/2005 11:11AM
Re: Communications link failure due to underlying exception Philipp Kuhrs 08/10/2005 07:48AM
Re: Communications link failure due to underlying exception Prafulla Girgaonkar 03/22/2006 08:20AM
Re: Communications link failure due to underlying exception Erwin Liem 03/23/2006 05:22AM
Re: Communications link failure due to underlying exception Prafulla Girgaonkar 03/23/2006 10:07AM
CORRECT SOLUTION: Communications link failure due to underlying exception Bohdan Bobylak 05/18/2006 10:22AM
Re: CORRECT SOLUTION: Communications link failure due to underlying exception Adam Pickett 05/29/2006 06:41AM
Re: CORRECT SOLUTION: Communications link failure due to underlying exception virtual spy 06/04/2006 02:47PM
Re: Communications link failure due to underlying exception Qaiser Mehmood 06/01/2006 12:44PM
MySQL fix?! Markus Cozowicz 06/09/2006 04:42AM
Re: MySQL fix?! Akhil 08/24/2006 05:27PM
Re: Communications link failure due to underlying exception Harikrishnan K 11/01/2006 05:52AM
Re: Communications link failure due to underlying exception Alex S 11/30/2006 11:31PM
Re: Communications link failure due to underlying exception Mahesh Yamsani 01/17/2007 11:19PM
date_format() bug, supposed fixed in 4.1.22 Alex S 11/30/2006 11:37PM
Re: date_format() bug, supposed fixed in 4.1.22 (confirmed) Alex S 12/01/2006 12:44AM
Re: Communications link failure due to underlying exception Jeff Smith 05/23/2007 04:29PM
Re: Communications link failure due to underlying exception (My Solution) Carlos Vela 01/18/2007 10:57AM
Solution C3p0 Re: Communications link failure due to underlying exception (My Solution) Richipal Singh 04/01/2007 04:10AM
Re: Solution C3p0 Ole van Boeckel 07/15/2007 04:27AM
Re: Communications link failure due to underlying exception sivakumar s 03/12/2008 03:51AM
Re: Communications link failure due to underlying exception thina karan 04/08/2008 05:43AM
java.policy most of the time! Andrei Todea 04/09/2008 06:01PM
Re: java.policy most of the time! Pape CISSE 05/13/2009 06:18AM
Re: Communications link failure due to underlying exception Venkata Raju 05/02/2008 01:35AM


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.