我想在 JSP 中通过查询将数据插入数据库。这是我的代码
<%@ include file="connect.jsp" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + application.getRealPath("WEB-INF/travDB.accdb"));
Statement st = con.createStatement(1004,1008);
String user = request.getParameter("username");
String pass = request.getParameter("pass");
String konf = request.getParameter("konf");
String phone = request.getParameter("phone");
String tribe = request.getParameter("tribe");
String start = request.getParameter("start");
String agree = request.getParameter("agree");
String temp = "";
query = "insert into msuser (username, password, email, tribe, starting position, population) values ('"+user+"','"+pass+"','"+phone+"','"+tribe+"','"+temp+"',0)";
st.executeUpdate(query);
response.sendRedirect("Register.jsp?err=0");
}
%>
为什么说
org.apache.jasper.JasperException: An exception occurred processing JSP page /JSP_H2Soal2_T213/doRegis.jsp at line 82
82: st.executeUpdate(query);
有人可以帮我吗?