注册 登录
编程论坛 新人交流区

eclipse 与 mysql 连接问题

w135791456 发布于 2007-11-14 15:30, 783 次点击

我用ECLIPSE 连接 MYSQL 驱动为org.gjt.mm.mysql.Driver 驱动放在J2SDK\LIB和TOMCAT/COMMON/LIB并在环境变量中加了驱动路径 运行代码
import java.sql.*;


public class person

{

private static final String Drivermanager = null;

public static void main(String args[])
{ Connection conn= null;
String s="jdbc:mysql://localhost/person?user=root&password=12345";
try

{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();

conn=DriverManager.getConnection(s);
System.out.print("连接成功");
}catch(Exception e)

{

System.out.println(e);
System.out.print("连接失败");
}
}
}

报错:java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
连接失败
在服务中已看见MYSQL启动,并且客户端也能登陆,我不知道这个错误是怎么回事,请高手门讲讲,不胜感激!!!

2 回复
#2
ryoung2007-11-14 16:39
我好像没遇到过这种错误呢?无能为力~
#3
devil_v62007-11-14 18:24
路过
1