<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<% request.setCharacterEncoding("utf-8");%>
<body bgcolor="#aee19b" style="text-align:center;">
<jsp:include page="Head.jsp" /><br>
<%
String id=(String)session.getAttribute("id");
String passwd=request.getParameter("passwd");
String name=request.getParameter("name");
String email=request.getParameter("email");
String job=request.getParameter("job");
ResultSet rs=null;

String sql=null;
try{
	   Class.forName("oracle.jdbc.driver.OracleDriver");
	   Connection  conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20162511","971204");
	   sql="select * from member where id=? ";
	   PreparedStatement pstmt=conn.prepareStatement(sql);
	   pstmt.setString(1, id);
	   
	   rs=pstmt.executeQuery(); //결과 가져옴
	  
	  if(rs.next()){
	  
	  	  pstmt=conn.prepareStatement("update member set pass=?,  name=?, email=?, job=? where id=?");
		                                    //UPDATE 테이블명 SET 컬럼명=새로운값 WHERE 업데이트조건 
		  
		  pstmt.setString(1,passwd);
		  pstmt.setString(2,name);
		  pstmt.setString(3,email);
		  pstmt.setString(4,job);
		  pstmt.setString(5,id);
		  
		  pstmt.executeUpdate();
		  out.println("정보수정 성공");
	 }else{
	 out.println("비밀번호틀림");
	 }

}catch(Exception e){
e.printStackTrace();
}finally{
}
%>
</body>