aspose file tools*
The moose likes JDBC and the fly likes Error in connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error in connection" Watch "Error in connection" New topic
Author

Error in connection

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi all,

I am using Mysql 4.1.11 on windows....and i wrote a piece of code for getting a connection but iam getting an error...

===============Code======================


but i get the following exception error...


==============Error====================

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:1080)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:619)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1532)
at com.mysql.jdbc.Connection.<init>(Connection.java:486)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:326)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Connection.JdbcConnMysql.main(JdbcConnMysql.java:29)


** END NESTED EXCEPTION **


at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:692)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1532)
at com.mysql.jdbc.Connection.<init>(Connection.java:486)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:326)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Connection.JdbcConnMysql.main(JdbcConnMysql.java:29)


Can you let me know where i was wrong...

Tx in advance,
Regards
[ May 21, 2006: Message edited by: Bear Bibeault ]
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
In general, "Unexpected end of input stream" is usually not a code problem, unless the process at "systemname:3306" isn't really a MySQL database.

More likely, it's one of:
1) using an older MySQL driver with a newer MySQL database
Latest stable driver here:
http://dev.mysql.com/downloads/connector/j/3.1.html
2) an intervening network device (e.g. firewall)
3) a broken/corrupt MySQL database
4) an OS level problem, either local or remote
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Thanks Stu!!!...Your suggestion worked...


In general, "Unexpected end of input stream" is usually not a code problem, unless the process at "systemname:3306" isn't really a MySQL database.

More likely, it's one of:

1) using an older MySQL driver with a newer MySQL database

Latest stable driver here:
http://dev.mysql.com/downloads/connector/j/3.1.html
2) an intervening network device (e.g. firewall)
3) a broken/corrupt MySQL database
4) an OS level problem, either local or remote


I was using 3.0.7 version previuosly...now 3.1.12..


Regards
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Error in connection