<%
request.setCharacterEncoding("utf-8");
String unm = request.getParameter("username");
String psd = request.getParameter("password");
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=dataBase;user=sa;password=sa;";
Connection conn = DriverManager.getConnection(connectionUrl);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="SELECT * FROM dataBase WHERE title = 'unm'";
//out.print(sql);
ResultSet rs = stmt.executeQuery(sql);
if(rs.next()){
request.getRequestDispatcher("loginSuccess.jsp").forward(request,response);
}else{
response.sendRedirect("loginFailure.jsp");
}
stmt.close();
conn.close();
%>
报错说sql语句中database附近有语法错误,望指教!万分感谢!