ps.executeUpdate();报错
<%@ page language="java" import="java.util.*,java.sql.*"pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
String username = request.getParameter("username");
String password = request.getParameter("password");
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "123456");
String sqlQuery = "select count(*) from users where username = ?";
PreparedStatement psQuery = conn.prepareStatement(sqlQuery);
psQuery.setString(1, username);
ResultSet rs = psQuery.executeQuery();
rs.next();
int count = rs.getInt(1);
if (count > 0) {
response.sendRedirect("success.jsp");
psQuery.close();
conn.close();
return;
}
String sql = "insert into users(username,password) values (?, ?)";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, username);
ps.setString(2, password);
ps.executeUpdate();
ps.close();
conn.close();
response.sendRedirect("star.jsp");
%>
希望大家能帮忙看一看哪里出错了