我在netBeans中创建了一个登录系统。我有index.jsp和一个调用login.jsp的表单(你在下面看到的)当login.jsp开始加载时,它从未完成加载,加载循环只是继续进行然后Tomcat告诉我这可能会导致内存泄漏,想法?
<%
Connection connectionDB = null;
PreparedStatement psDB = null;
ResultSet rsDB = null;
String getUsername = request.getParameter("loginUsername");
String getPassword = request.getParameter("loginPassword");
String sql = "SELECT Username, Password FROM SKAWEB WHERE Username= '" +
getUsername + "' AND Password='" + getPassword + "'";
String driverName = "com.mysql.jdbc.driver";
String DATABASE_URL = "jdbc:mysql://localhost:1527/SKAWEB";
String userDB = "emmron";
String passDB = "test";
out.println("testing123");
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
try {
connectionDB = DriverManager.getConnection(DATABASE_URL, userDB, passDB);
psDB = connectionDB.prepareStatement(sql);
rsDB = psDB.executeQuery();
out.println("hello");
if(rsDB.next()) {
out.println("yay");
}
}
catch (Exception errorMessage) {
errorMessage.printStackTrace();
out.println("blah");
}
%>