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());
}
}
}