你用什么方式连接数据库的?试试下边的方式。
1、可能是没有引那个包。
2、看看你的路径是否有问题。
3、你确定String url ="jdbc:mysql://localhost:3306/free?没有问题吗?主要是端口号。
4、去掉useUnicode=true&characterEncoding=GBK";试试。

解决方案 »

  1.   

    Connection conn = DriverManager.getConnection(url,);?
    试一试:
    jdbc:mysql://localhost:3306/free?user=root&password=mysql&useUnicode=true&characterEncoding=GBK
      

  2.   


    用的url="jdbc:mysql://localhost:3306/free?user=root&password=mysql&useUnicode=true&characterEncoding=GBK"
    还是不行。在Mysql Administrator里已经启动了阿:Trying to start the server ...Server was started.换了一个包(C:\jdbc\mm.mysql-2.0.4-bin.jar)已经放到classpath了。
    端口是3306
    这时在命令提示符下已经能够修改数据库了.
    提示出错信息变了:
    /////
    java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
    at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:327)
    at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)
    at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
    at org.gjt.mm.mysql.Driver.connect(Driver.java:167)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at Frame1.main(Frame1.java:369)
      

  3.   

    1. MySQL(http://www.mysql.com)mm.mysql-2.0.2-bin.jar 
    Class.forName( "org.gjt.mm.mysql.Driver" ); 
    cn = DriverManager.getConnection( "jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName", sUsr, sPwd ); Connection conn = DriverManager.getConnection(url,);
                                                  ^^^^^^
                                                  这里加了逗号,为什么不加参数呢?
      

  4.   

    DriverManager.getConnection(url,);
    老大,这句话怎么解释??
      

  5.   

    to  zyg158(DD),guo_com(guo.com) :那个是我错了,编译的时候已经改了.
    错误依然阿.
    to  speedingman(尘埃):装client?Mysql官方网站上的Mysql4.1版本不是完整的么
      

  6.   

    Communication failure during handshake. Is there a server running on localhost:3306?你的MYSQL没有启动啦。
      

  7.   

    Communication failure during handshake. Is there a server running on localhost:3306?没启动吧?
      

  8.   

    我发现mysql的提示总是很搞笑.以前好像有个类似"东西太大,我运行不了"的提示,我第一次看到,差点.....看你这个提示,好像mysql的进程没有运行吧.
      

  9.   

    http://www.mysql.com/products/connector/j再换个jdbc Driver, mm 那个太老了调用:Class.forName("com.mysql..jdbc.Driver").newInstance();
      

  10.   

    调用:Class.forName("com.mysql.jdbc.Driver").newInstance();
      

  11.   

    http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-3.0.16-ga.zip/from/pick