Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to deal with this SQLException.

 
Jerry Du
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,everyone.Greetings!
I have got this problem for days when i try to run my code with mysql in linux.
And i have downloaded most latest version of jdbc driver---mysql-connector-java-3.06-stable.tar.gz
and i also have it in my classpath. but when i run java code, it just reports following errors:

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:1073)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:380)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1511)
at com.mysql.jdbc.Connection.<init>(Connection.java:485)
at com.mysql.jdbc.Driver.connect(Driver.java:341)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at EmployeesTableQuery.main(EmployeesTableQuery.java:19)

** END NESTED EXCEPTION **
*****************************************
And my code is as following:

thx for your kind help.
my email: jerrydu88@hotmail.com
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jerry,
This is just a guess, but it looks like your database server is not running. Have you checked that?
Hope this helps.
Good Luck,
Avi.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"du du",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic