Communication link failure:Bad handshake这是什么错误?

Mybox 2005-11-22 05:16:50
一个java连接mysql数据库的程序,以前能运行的。重装了系统后不能运行,提示错误: Communication link failure:Bad handshake
哪位高手知道是什么原因?mysql的驱动都配置好了的.现在的系统是windows server 2003.是不是com.mysql.jdbc.Driver与这个新的系统不配?

程序源代码如下:

import java.sql.*;
public class CreateTb
{
public static void main(String[] args)
{
   String sqlCmd;
sqlCmd = "create table AuditDatabase("+
"strUserId varchar(20), strOpName varchar(20),"+
"dDate Date,tTime Time, iResult tinyint )";


String driver="com.mysql.jdbc.Driver";
String source="jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=gb2312";
try{//查找用于JDBC的类
Class.forName(driver);

}
catch(ClassNotFoundException exec)
{
System.out.println("Don't find "+driver);
// Syestem.exit(1);
}
try{//建立与指定数据库的连接
Connection connection=DriverManager.getConnection(source,"root","");

//创建一个用于执行预编译SQL的语句对象

Statement stm=connection.createStatement();
stm.execute(sqlCmd);
System.out.println("ok ");

//关闭数据库连接

stm.close();
connection.close();
}
catch(SQLException exec)
{
System.err.println(exec.getMessage());
}


}


}
...全文
1275 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Mybox 2005-11-22
  • 打赏
  • 举报
回复
Communication link failure:Bad handshake是jcreator提示的错误
Mybox 2005-11-22
  • 打赏
  • 举报
回复
但是我的root是没有密码的,mysql用root空密码也能用呀
computerclass 2005-11-22
  • 打赏
  • 举报
回复
Why do I receive the "Communication link failure: bad handshake" error message when migrating from MySQL?
You may receive this error message during Step 1: Source Database Details of the Capture Wizard. To resolve this error message, verify the following conditions:

The root user exists and has sufficient privileges on the MySQL server.


The password you are using for the root user is correct.


The password is exactly eight characters in length. In some versions of MySQL the password for the root user must be exactly eight characters to allow a connection through a third party product using JDBC or ODBC drivers. This is true even if a password that is not eight characters long allows you to connect through MySQL client programs.


The server name, system (host) that you are connecting from has access rights to the MySQL user table.
myth822 2005-11-22
  • 打赏
  • 举报
回复
首先:
确认用户名正确

确认密码正确

确认密码长度大于 6 位

确认服务可以使用

然后:
将 \WEB-INF\lib目录下的 connnector 升级到和现在的数据库匹配

最后:
检查Server(例如:tomcat)下的lib中的connnector 是否与现在的数据库匹配,更新之

62,628

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧