各位兄弟姐妹,早上好,我是jsp菜鸟,昨天试了下用dreamweaver链接mysql数据库时,报错~~
我的新建的是jsp页面,在数据库面板中选择了MYSQL驱动程序,
驱动连接名称:jsp
驱动程序:org.gjt.mm.mysql.Driver
URL:jdbc:mysql://[hostname]/[database name]在单击测试的时候报错:
org/gjt/mm/mysql/Driver class not found请问这是为什么,谢谢各位!!

解决方案 »

  1.   

    URL:jdbc:mysql://[hostname]/[database name] 
    这是你原封不动的URL嘛?
    是的话把[hostname]/[database name] 换成真实的路径如果你写的就是真实路径的话,换个驱动试试
      

  2.   

    别用dreamweaver连接了,你学习下怎么自己写连接吧貌似没几个人用你那个连。看看有关JDBC地书籍。
      

  3.   

    找不到MYSQL驱动程序类,用得tomcat吗?,把MYSQL驱动程序类拷贝到tomcat下的common/lib文件夹下试试!
      

  4.   

    连接代码:public static Connection getConn() {
    Connection conn = null;
    try {
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/bbs", "root" , "root");
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    return conn;
    }

    public static Statement createStmt(Connection conn) {
    Statement stmt = null;
    try {
    stmt = conn.createStatement();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    return stmt;
    }

    public static ResultSet executeQuery(Statement stmt, String sql) {
    ResultSet rs = null;
    try {
    rs = stmt.executeQuery(sql);
    } catch (SQLException e) {
    e.printStackTrace();
    }
    return rs;
    }

    /*public static ResultSet executeQuery(Connection conn, String sql) {
    Statement stmt = null;
    ResultSet rs = null;
    try {
    stmt = conn.createStatement();
    rs = stmt.executeQuery(sql);
    } catch (SQLException e) {
    e.printStackTrace();
    }
      

  5.   

    哦买嘎的~~虽然我很佩服很佩服楼上的,但是我还是看不懂~~我请问下,URL:jdbc:mysql://[hostname]/[database name] 
    中的hostname是啥?
    database name是啥?多谢多谢!
      

  6.   

    hostname 是你的主机名 改为 localhost:3306 试试(记得3306是mysql的默认端口)
    database name 是你建立的数据库名称