Results 1 to 3 of 3
  1. #1
    PrinceSendai is offline Member
    Join Date
    Jul 2010
    Location
    Lima, Peru
    Posts
    47
    Rep Power
    0

    Default Communications Link Failure

    I get a Communications Link Failure when connecting. Any ideas on why this is and how to fix it?

    Much help would be appreciated.

    Java Code:
    		try {
    			Class.forName("com.mysql.jdbc.Driver").newInstance ();
                connection = DriverManager.getConnection(url, user, password);
    
    
            } catch (Exception e) {
                Logger logger = Logger.getLogger(Licensing.class.getName());
                logger.log(Level.SEVERE, e.getMessage(), e);
                return;
            }

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsExce ption: Communications link failure

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:41 1)
    at com.mysql.jdbc.SQLError.createCommunicationsExcept ion(SQLError.java:1116)
    at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:700 )
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:11 10)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(Connecti onImpl.java:2389)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(Co nnectionImpl.java:2422)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(Connecti onImpl.java:2207)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImp l.java:797)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connect ion.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:41 1)
    at com.mysql.jdbc.ConnectionImpl.getInstance(Connecti onImpl.java:389)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:305)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at aGeneral.Licensing.connect(Licensing.java:27)
    at aGeneral.Licensing.<init>(Licensing.java:22)
    at aGeneral.App.<init>(App.java:60)
    at aGeneral.App$1.run(App.java:39)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectio nPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3041 )
    at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:624 )
    ... 33 more

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Communications Link Failure

    Are you sure the url and username/password are correct?
    Also, check for possible firewall problems.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    PrinceSendai is offline Member
    Join Date
    Jul 2010
    Location
    Lima, Peru
    Posts
    47
    Rep Power
    0

    Default Re: Communications Link Failure

    Quote Originally Posted by Tolls View Post
    Are you sure the url and username/password are correct?
    Also, check for possible firewall problems.
    Thanks man. I believe the issue was with the URL:


    "jdbc:mysql:hostname/dbname" correct, instead of "jdbc:mysql://hostname:8080/dbname"

Similar Threads

  1. SQLException caught: Communications link failure due to underlying exception: **
    By sharanya in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-25-2011, 10:46 AM
  2. ERROR: Communications link failure [help]
    By APRENTI in forum Advanced Java
    Replies: 15
    Last Post: 02-24-2011, 08:24 PM
  3. Replies: 1
    Last Post: 12-15-2010, 09:16 AM
  4. ECLIPSE + MYSQL Communications link failure due to underlying exception
    By transistor47 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-17-2009, 12:21 AM
  5. SQLException: Communications link failure
    By etherkye in forum JDBC
    Replies: 0
    Last Post: 07-03-2009, 05:20 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •