Bug #4185 SQLException: Communication link failure - on remote machine
Submitted: 17 Jun 2004 14:23 Modified: 15 Sep 2004 16:09
Reporter: Sulabh Nangalia Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.23.52 OS:Linux (Linux 8)
Assigned to: CPU Architecture:Any

[17 Jun 2004 14:23] Sulabh Nangalia
Description:
I am using MySQl 3.23.52 that comes with Linux 8 distribution.
When I try to run the following java code to connect to the server running on a remote machine(on the same lan), I get the following error:

Java code:
==========================
               try
                {
                        Class.forName("com.mysql.jdbc.Driver").newInstance();
                }catch(Exception ex)
                {
                        System.out.println(ex.getMessage());
                        System.exit(0);
                }
                try
                {
                        conn = DriverManager.getConnection("jdbc:mysql://192.168.100.38:3306/IntelligentDirectory?user=sulabh&password=sulabh");
                        System.out.println("Connection Established");
                }catch(SQLException sqlEx)
                {
                        System.out.println("SQLException: " + sqlEx.getMessage());
                        System.out.println("SQLState: " + sqlEx.getSQLState());
                        System.out.println("VendorError: " + sqlEx.getErrorCode());
                        System.exit(0);
                }
=====================

Exception:
==========================
SQLException: Communication link failure: java.io.EOFException, underlyi
ng cause: null

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1388)
        at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1407)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:621)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1771)
        at com.mysql.jdbc.Connection.<init>(Connection.java:440)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:400)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:193)
        at Connect.<init>(Connect.java:28)
        at Server.search(Server.java:48)
        at Server.main(Server.java:411)

** END NESTED EXCEPTION **

SQLState: 08S01
VendorError: 0
========================

When I run the same code on the machine(192.168.100.38) on which the server is running, I am able to run it properly.

My /etc/my.cnf file has following entries:
========================
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
=========================

What is the problem? Please help me.
Thanks in advance.

Sulabh

How to repeat:
Try to run the same code on remote machine.
[23 Jun 2004 21:39] Mark Matthews
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.
[24 Jun 2004 6:44] Sulabh Nangalia
Dear Matthews

Thanks for the reply.
I have installed MySQL 3.23.52 from the standard Linux 8 CDs which, I think, should be a stable version. If you insist that I should install a newer version, then which stable version should I download. Also I am using using the latest stable version of MySQL Connector/J (3.0)

Sulabh
[24 Jun 2004 15:07] Mark Matthews
3.23.52 is definitely not the latest stable version (it was released in August of 2002), 3.23.58 is the latest in the 3.23 branch, according to the website at http://dev.mysql.com/downloads/mysql/3.23.html, however the 4.0.20 in the 4.0 branch is actually the _latest_ stable version (3.23 is a 'retired' branch):

http://dev.mysql.com/downloads/mysql/4.0.html
[15 Sep 2004 15:55] Ales Justin
I have the same problem.

Running MySql server 4.0.20 and MySql Connector 3.0.18.

What is to do here?

Thanx, Ales

-------------------------------

org.quartz.SchedulerConfigException: Failure occured during job recovery. [See n
ested exception: org.quartz.JobPersistenceException: Failed to obtain DB connect
ion from data source 'myDS': org.apache.commons.dbcp.SQLNestedException: Cannot 
create PoolableConnectionFactory, cause: Communication link failure: java.io.EOF
Exception, underlying cause: null

** BEGIN NESTED EXCEPTION ** 

java.io.EOFException

STACKTRACE:

java.io.EOFException
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1388)
        at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1407)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:621)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1771)
        at com.mysql.jdbc.Connection.<init>(Connection.java:440)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:400)
        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(Driv
erConnectionFactory.java:82)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(Poolable
ConnectionFactory.java:300)
        at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(Bas
icDataSource.java:838)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:821)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:518)
        at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConne
ctionProvider.java:180)
        at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManage
r.java:119)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSu
pport.java:526)
        at org.quartz.impl.jdbcjobstore.JobStoreTX.cleanVolatileTriggerAndJobs(J
obStoreTX.java:113)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSuppo
rt.java:479)
at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize(JobStoreTX.java:74
)
        at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.j
ava:772)
        at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.
java:904)
        at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerF
actory.java:920)
        at com.generalynx.smsmailman.client.Initializer.schedulerInit(Initialize
r.java:73)
        at com.generalynx.smsmailman.client.Initializer.init(Initializer.java:47
)
        at com.generalynx.smsmailman.client.DaoSupport.<init>(DaoSupport.java:26
)
        at com.generalynx.smsmailman.client.Sender.<init>(Sender.java:56)
        at com.generalynx.webcontrol.logic.broadcast.Sender.sendSMS(Sender.java:
146)
        at com.generalynx.webcontrol.logic.data.dbase.ControlUnit.read(ControlUn
it.java:69)
        at com.generalynx.webcontrol.web.controller.MainAction.executeAction(Mai
nAction.java:66)
        at com.generalynx.webcontrol.web.controller.AbstractAction.execute(Abstr
at com.generalynx.webcontrol.web.controller.AbstractAction.execute(Abstr
actAction.java:29)
        at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
2)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at com.generalynx.common.filters.SetCharacterEncodingFilter.doFilter(Set
CharacterEncodingFilter.java:170)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:213)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:190)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2343)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
468)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:1012)
        at org.apache.ca
va:1122)
        at java.lang.Thread.run(Thread.java:534)

** END NESTED EXCEPTION **

 [See nested exception: org.apache.commons.dbcp.SQLNestedException: Cannot creat
e PoolableConnectionFactory, cause: Communication link failure: java.io.EOFExcep
tion, underlying cause: null

** BEGIN NESTED EXCEPTION ** 

java.io.EOFException

STACKTRACE:

java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1388)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1407)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:621)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1771)
at com.mysql.jdbc.Connection.<init>(Connection.java:440)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
       at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:400)
        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(Driv
erConnectionFactory.java:82)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(Poolable
ConnectionFactory.java:300)
        at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(Bas
icDataSource.java:838)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:821)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:518)
        at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConne
ctionProvider.java:180)
        at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManage
r.java:119)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSu
pport.java:526)
        at org.quartz.impl.jdbcjobstore.JobStoreTX.cleanVolatileTriggerAndJobs(J
obStoreTX.java:113)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSuppo
rt.java:479)
at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize(JobStoreTX.java:74
       at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize(JobStoreTX.java:74
)
        at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.j
ava:772)
        at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.
java:904)
        at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerF
actory.java:920)
        at com.generalynx.smsmailman.client.Initializer.schedulerInit(Initialize
r.java:73)
        at com.generalynx.smsmailman.client.Initializer.init(Initializer.java:47
)
        at com.generalynx.smsmailman.client.DaoSupport.<init>(DaoSupport.java:26
)
        at com.generalynx.smsmailman.client.Sender.<init>(Sender.java:56)
        at com.generalynx.webcontrol.logic.broadcast.Sender.sendSMS(Sender.java:
146)
        at com.generalynx.webcontrol.logic.data.dbase.ControlUnit.read(ControlUn
it.java:69)
        at com.generalynx.webcontrol.web.controller.MainAction.executeAction(Mai
nAction.java:66)
        at com.generalynx.webcontrol.web.controller.AbstractAction.execute(Abstr
actAction.java:29)
        at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
2)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at com.generalynx.common.filters.SetCharacterEncodingFilter.doFilter(Set
CharacterEncodingFilter.java:170)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:213)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipelin
[15 Sep 2004 15:59] Ales Justin
Sorry - not 3.0.18, but:

mysql-connector-java-3.0.14-production-bin.jar

Ales
[15 Sep 2004 16:09] Mark Matthews
How 'remote' is this machine? If you don't have the default timeouts set appropriately for high-latency links on your mysql server ('connect_timeout' for example), you can see this problem.
[16 Sep 2004 7:48] Ales Justin
This machine runs on the same server as Tomcat.
>>jdbc:mysql://localhost/genera?user=...

I get this exception using "org.apache.commons.dbcp.BasicDataSource" in Quartz scheduler, but I also have MVC app, to which I connect using plane JDBC connection (and my own connection pool) - and this works without a problem.

Ok, I would understand if in no case I would be able to connect.
Is there some important default property that is set different on bussines machine (admined by inet provider) than my own, since when testing localy everything works. 

Thanx, Ales