JAVA和SQl

来源:百度知道 编辑:UC知道 时间:2024/05/17 23:02:09
stmt.close();
conn.close();
response.sendRedirect(response.encodeURL("ROOT/login.jsp"));
}

}

}catch(SQLException ex){
out.println(ex.getMessage());
out.println(ex.getSQLState());
out.println(ex.getErrorCode());
ex=ex.getNextException();

}

out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t</body>\r\n");
out.write("</html>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t)

描述的不清楚

stmt.executeUpdate(INSERT INTO TABLE2 VALUES('_u
sername','_password';));
改为
stmt.executeUpdate("INSERT INTO TABLE2 VALUES('_u
sername','_password')");

如果_username和_password是变量就还要改一下
stmt.executeUpdate("INSERT INTO TABLE2 VALUES('"+_u
sername+"','"+_password+"')");