Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- //Step1: Load JDBC Driver
- Class.forName("com.mysql.jdbc.Driver");
- // Step 2: Define Connection URL
- String connURL ="jdbc:mysql://localhost/spairlines_data?user=root&password=s9903632z";
- // Step 3: Establish connection to URL
- Connection conn = DriverManager.getConnection(connURL);
- String loginid =request.getParameter("loginid");
- String password =request.getParameter("password");
- String sqlStr ="select * from admin_table where Administrator=? and Password=?";
- PreparedStatement pstmt=conn.prepareStatement(sqlStr);
- pstmt.setString(1,loginid);
- pstmt.setString(2,password);
- ResultSet rs=pstmt.executeQuery();
- if (rs.next()) {
- response.sendRedirect("search.jsp");
- } else {
- response.sendRedirect("loginform.jsp");
- }
- /* out.println("<table border='1'>");
- while(rs.next()){
- loginid=rs.getString("loginid");
- password=rs.getString("password");
- } */
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement