forked from seming/dbproject_courseregistration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_verify.jsp
48 lines (43 loc) · 1.49 KB
/
update_verify.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
<%@ page contentType="text/html;charset=EUC-KR" %>
<%@ page import="java.sql.*" %>
<html>
<head><title> 수강신청 사용자 정보 수정 </title></head>
<body>
…..
<%
String session_id= (String)session.getAttribute("user");
Connection myConn = null;
Statement stmt = null;
String mySQL = null;
String dburl = "jdbc:oracle:thin:@localhost:1521:orcl";
String user = "db01";
String passwd = "ss2";
String jdbc_driver = "oracle.jdbc.driver.OracleDriver";
String s_id = request.getParameter("s_id");
String s_pwd = request.getParameter("s_pwd");
String s_name = request.getParameter("s_name");
String s_major = request.getParameter("s_major");
String s_grade = request.getParameter("s_grade");
try{
Class.forName(jdbc_driver);
myConn = DriverManager.getConnection (dburl, user, passwd);
stmt = myConn.createStatement();
mySQL = "update student set s_id ='"+s_id+"', s_pwd='"+s_pwd+"', s_name='"+s_name+"', s_major='"+s_major+"',s_grade='"+s_grade+"'" ;
ResultSet rs = stmt.executeQuery(mySQL);
out.println("<script>alert('회원정보가 수정되었습니다.');</script>");
out.println("<script>location.href= \"update.jsp\";</script>");
} catch(SQLException ex) {
String sMessage;
if (ex.getErrorCode() == 20002) sMessage="암호는 4자리 이상이어야 합니다";
else if (ex.getErrorCode() == 20003) sMessage="암호에 공란은 입력되지 않습니다.";
else sMessage="잠시 후 다시 시도하십시오";
}
finally{
if(stmt != null){
stmt.close();
myConn.close();
}
}
%>
…
</body></html>