- This topic has 8 replies, 3 voices, and was last updated 18 years, 9 months ago by
Michael Naumann.
-
AuthorPosts
-
tulipgraphicsMemberOn 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 streamSTACKTRACE:
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]February 2, 2006 at 5:04 pm #245971
snpeMemberif mysql don’t register connection you set wrong url , probably
check url or send more details : mysql version, connection details (driver, url etc) ?February 2, 2006 at 5:33 pm #245972
tulipgraphicsMembermysql 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.DriverFebruary 2, 2006 at 5:42 pm #245973
snpeMemberand you sure that URL is correct ?
Can you try with little java application ?
February 2, 2006 at 6:06 pm #245974
tulipgraphicsMemberyes, 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….
February 2, 2006 at 6:13 pm #245975
snpeMembercan you try this
make java project and add your jdbc driver jar in classpath
change url to your url and run applicationimport 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"); } }
February 2, 2006 at 11:49 pm #245978
tulipgraphicsMemberOK, I tried that program and got the same error (and tracktrace) as my original post.
February 3, 2006 at 1:50 am #245981
tulipgraphicsMemberOK 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!
September 11, 2006 at 7:47 pm #258422
Michael NaumannMemberThanks bnash74! This was driving me nuts…
Removing the stale jar from /Library/Java/Extensions/ provided immediate
relief (at long last!). -
AuthorPosts