forked from halnigalni/DB_Team3_Phase4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
findpwing.jsp
54 lines (46 loc) · 1.34 KB
/
findpwing.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page language = "java" import ="java.text.*, java.sql.*,java.util.ArrayList"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="gologin.jsp" method = "POST">
<%
String id = request.getParameter("id");
String name = request.getParameter("name");
String pw="";
String serverIP = "localhost";
String strSID = "orcl";
String portNum = "1521";
String user = "university";
String pass = "comp322";
String url = "jdbc:oracle:thin:@"+serverIP+":"+portNum+":"+strSID;
Connection conn = null; // Connection object
Statement stmt = null; // Statement object
ResultSet rs;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection(url,user,pass);
String is_exist="";
String sql ="";
try {
conn.setAutoCommit(false);
stmt = conn.createStatement();
sql = "SELECT password FROM ACCOUNT WHERE name = '"+name+"' AND Account_id ='"+id+"'";
rs = stmt.executeQuery(sql);
if(rs.next()) { //일치하는 정보가 있을 때
pw = rs.getString(1);
}
}catch(SQLException ex2) {
System.err.println("sql error = "+ex2.getMessage());
System.exit(1);
}
session.setAttribute("pw",pw);
response.sendRedirect("gologin2.jsp");
%>
</form>
</body>
</html>