<%@ 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");%>
<%
String id=request.getParameter("id");
String passwd=request.getParameter("passwd");
String name=request.getParameter("name");
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","20162496","980216");
sql="select * from MEMBER_TABLE where id=? ";
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setString(1, id);
	   
rs=pstmt.executeQuery();
	  
if(rs.next()){
String dbPass=rs.getString("passwd");
if(passwd.equals(dbPass)){
pstmt=conn.prepareStatement("update MEMBER_TABLE set passwd=?, name=?  where id=?");
	  	  
pstmt.setString(3,id);
pstmt.setString(1,passwd);
pstmt.setString(2,name);
		  
pstmt.executeUpdate();
out.println("회원정보를 수정하였습니다.");
}else{
out.println("비밀번호가 틀립니다.");
}}

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