|
Windows下用记事本写了段java代码:
import java.sql.*;
public class Test{
public static void main(String args[]){
Connection conn=null;
String sql="jdbc:mysql://127.0.0.1/my?user=root&password=root&useUnicode=true&characterEncoding=GB2312";
try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
}
catch (Exception E) {
System.out.println("Unable to load driver.");
}
try{
conn = DriverManager.getConnection(sql);
}catch(Exception e){
System.out.println(e);
}
try{
Statement stmt = conn.createStatement();
}catch(Exception e){
System.out.println(e);
}
}
}
加载驱动没有错,连接数据库的时候出这个错
java.sql.SQLException:Communicatin failure during handshake.Is there a server running on 192.168.0.102:3306?
怎么回事啊??mysql是启动了的 |
|