org.apache.jasper.JasperException: An exception occurred processing JSP page /registration.jsp at line 9
6: String lname = request.getParameter("lname");
7: String email = request.getParameter("email");
8: Class.forName("com.mysql.jdbc.Driver");
9: Connection con = DriverManager.getConnection("jdbc:mysql://localhost:8080/dbname",
10: "root", "NEWPASSWORD");
11: Statement st = con.createStatement();
12: ResultSet rs;
有人可以帮助我这是我的jsp连接到mysql代码。我不明白这个错误。
答案 0 :(得分:0)
我的sql正在端口号 3306
上运行因此你应该编写如下代码
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname","root", "NEWPASSWORD");
答案 1 :(得分:0)
String lname = request.getParameter("lname");
String email = request.getParameter("email");
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(“jdbc:mysql:// localhost:3306 / dbname”, “root”,“NEWPASSWORD”);
Statement st = con.createStatement();
ResultSet rs;