http://tech.ccidnet.com/pub/article/c1110_a173155_p1.html

解决方案 »

  1.   

    代码没有错误。楼主可以直接通过application来测试一下能不能连接到数据库。如果也不行,那应该是mm.mysql-2.0.4-bin.jar包有问题。
      

  2.   

    org.gjt.mm.mysql.Driver它用的是Connect/J 3.0以上的版本的,以前的不是这个是另外一个。
      

  3.   

    以前的是com.mysql.jdbc.Driver.是这个,楼主把Driver换成这个试试。
      

  4.   

    我写的一个数据库连接,给你参考一下,默认是连接mysql,serverType等于sqlserver的时候连接的是sqlserver:
    public final Connection myConn(String serverType) throws SQLException,
    InstantiationException, IllegalAccessException,
    ClassNotFoundException {
    Connection conn = null;
    String driver = new String();
    String connString = new String();
    driver = "com.mysql.jdbc.Driver";
    connString = "jdbc:mysql://localhost/dreamsite?user=root&password=";
    if (serverType.equals("sqlserver")) { 
    driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
    } Class.forName(driver).newInstance();
    conn = DriverManager
    .getConnection("jdbc:mysql://localhost/dreamsite?user=root&password="); if (serverType.equals("sqlserver")) {
    connString = "jdbc:microsoft:sqlserver://192.168.2.100:1433;databaseName=video";
    String databaseName = "sa";
    String password = "123456"; conn = DriverManager.getConnection(connString, databaseName,
    password); }
    return conn;
    }
      

  5.   

    用mysql自己的最新驱动就可以了