我在 Eclipse 中添加了 mysql j 连接器。但仍然说找不到适合 jdbc 的驱动程序:mysql://localhost:3306/

阿南多·海德尔

// 我已经连接了 mysql j 连接器,但仍然出错。我已将 jar 文件放在 WEB-INF 目录的 lib 文件夹中。

公共类 TransportCompanySignUpClass 扩展 HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {

    try {
        Class.forName("com.mysql.jdbc.Driver");
    } catch (ClassNotFoundException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    try {
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/practice"+"?autoReconnect=true&useSSL=false", "root", "haider665");
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

}

比尔汉·尼加

将 jar 文件添加到 WEB-INF/lib 而不是库中。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章