Jsp 未找到适合jdbc的驱动程序:mysql://localhost:3306/finalproject
这是我的test.jsp代码Jsp 未找到适合jdbc的驱动程序:mysql://localhost:3306/finalproject,jsp,Jsp,这是我的test.jsp代码 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="java.sql.*" import="java.io.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/T
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
import="java.sql.*"
import="java.io.*"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Final Project</title>
</head>
<body>
<center><h1>New Registration Page</h1></center>
<table border="1" align="center">
<tr>
<td>
<table border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<form action=Profile.jsp method="get">
<td>First Name*:</td> <!-- we need a button that says show profile then link it here -->
<td><input type="text" name="firstname"></td>
</tr>
<tr>
<td colspan="3"><center><input type="submit" value="Submit!"></center></td>
</form>
</tr>
</table>
</td>
</tr>
</table>
</body>
最终项目
新注册页
姓名*:
此文件与profile.jsp连接。
提交test.jsp时,没有找到适合jdbc的驱动程序:mysql://localhost:3306/finalproject 错误来自于
<%
Class.forName("java.sql.Connection");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/finalproject", "root", "vietforlife");
String firstname=request.getParameter("firstname");
Statement statement = connection.createStatement();
ResultSet resultset = statement.executeQuery("SELECT FirstName, LastName, Username, Password1, Password2, Email FROM userid WHERE FirstName = '"+firstname+"'");
%>
我认为我的数据库没有与jsp文件连接。
我遵循了类似问题的说明,但这不起作用。
你们能帮我个忙吗?你们用错了驾驶者的学名
改变 到 看一看这本书 更新 它给出java.lang.ClassNotFoundException:com.mysql.jdbc.Driver错误 为了避免
ClassNotFoundException
,你可以从 相关链接
Class.forName("com.mysql.jdbc.Driver")
不要忘记为此包含jar文件。如果我使用该文件,它会给出java.lang.ClassNotFoundException:com.mysql.jdbc.Driver错误。这就是为什么我将其更改为java.sql.connection。@user3069146:如果我的答案解决了您的问题,那么您可以将答案标记为已接受。参见
:3306
是可有可无的。
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver")