facebook

Communication Link Failure using MySQL

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #245969 Reply

    On Mac OS X 10.4.4, running Eclipse v 3.1.1 with MyEclipse 4.1.0 I’m trying to connect to MySQL using the Database Explorer. I’m using the latest MySQL Connector/J available (3.1.12) and I’m getting the following exception. When I watch the mysql log, it’s not even seeing that a connection has begun:

    !MESSAGE Error while trying to login to database
    !STACK 0
    java.sql.SQLException: Communication link failure: java.io.IOException, underlying cause: Unexpected end of input stream

    ** BEGIN NESTED EXCEPTION **

    java.io.IOException
    MESSAGE: Unexpected end of input stream

    STACKTRACE:

    java.io.IOException: Unexpected end of input stream
    at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:339)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:782)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:1585)
    at com.mysql.jdbc.Connection.<init>(Connection.java:524)
    at com.mysql.jdbc.Driver.connect(Driver.java:359)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:99)
    at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:43)
    at java.lang.Thread.run(Thread.java:613)

    ** END NESTED EXCEPTION **

    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:876)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:1585)
    at com.mysql.jdbc.Connection.<init>(Connection.java:524)
    at com.mysql.jdbc.Driver.connect(Driver.java:359)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:99)
    at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:43)
    at java.lang.Thread.run(Thread.java:613)[/list]

    #245971 Reply

    snpe
    Member

    if mysql don’t register connection you set wrong url , probably
    check url or send more details : mysql version, connection details (driver, url etc) ?

    #245972 Reply

    mysql version: 5.0.13
    connection URL: jdbc:mysql://our.host.name:3306/db_name
    user: our user
    pass: our password
    driver: MySQL Connector/J Driver
    jar: myql-connector-java-3.1.12-bin.jar
    Driver classname com.mysql.jdbc.Driver

    #245973 Reply

    snpe
    Member

    and you sure that URL is correct ?

    Can you try with little java application ?

    #245974 Reply

    yes, I tried that using a shareware client app for OS X called CocoaMySQL and it was able to make a connection using the same URL, and credentials….

    #245975 Reply

    snpe
    Member

    can you try this
    make java project and add your jdbc driver jar in classpath
    change url to your url and run application

    
    import java.sql.DriverManager;
    import java.sql.SQLException;
    
    public class TestDriver {
    
        private static String driverName = "com.mysql.jdbc.Driver";
    
        private static String url = "jdbc:mysql://HOST_NAME/DB)NAME";
    
        public static void main(String[] args) {
            try {
                Class.forName(driverName);
                DriverManager.getConnection(url);
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                System.exit(1);
            } catch (SQLException e) {
                e.printStackTrace();
                System.exit(1);
            }
    
            System.out.println("Connection is fine");
        }
    
    }
    
    #245978 Reply

    OK, I tried that program and got the same error (and tracktrace) as my original post.

    #245981 Reply

    OK it’s working…here’s what I found…opefully this will help some other OS X users with this problem…

    There were old version of the MySQL driver in the following location: /Library/Java/Extensions/ and ~user/Library/Java/Extensions/

    It appears that on OS X these location take precedence over the $CLASSPATH environment variable. Once I moved those .jar files, the connection worked right away.

    snpe, thanks for your time and your help!

    #258422 Reply

    Thanks bnash74! This was driving me nuts…

    Removing the stale jar from /Library/Java/Extensions/ provided immediate
    relief (at long last!).

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Communication Link Failure using MySQL

You must be logged in to post in the forum log in