Intellij找不到mysql JDBC驱动程序
我添加了MySQL JDBC驱动程序,但我一直遇到以下错误:找不到JDBC
的合适驱动程序。
这是我正在尝试的代码:
public class Test extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/jsp1", "root", "");
System.out.println("Connected successfully");
} catch (Exception e) {
e.printStackTrace();
}
}
}
这是项目设置。
我添加mysql jar,就会出现以下一个问题:
我已经尝试了上面的所有三个选项,但是我一直遇到相同的错误。
I have added MySQL JDBC driver but I keep getting the following error: No suitable driver found for jdbc
.
Here's the code that I'm trying:
public class Test extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/jsp1", "root", "");
System.out.println("Connected successfully");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Here are the project settings.
As soon as I add MySQL jar, one following problem appears:
I have tried all of the three options above, but I keep getting the same error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论