<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
      <%@page import ="java.util.Enumeration" %>
    <%@ 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"); %>
    
    <% // 6개
    String id = request.getParameter("id");  // Form에 있는 값을 받아옴
    String yy = request.getParameter("yy");
    String mm = request.getParameter("mm");
    String dd = request.getParameter("dd");
    String ymd = yy+"년"+mm+"월"+dd+"일";
    String NAME = request.getParameter("NAME");

    String e2 = request.getParameter("email");
    String e1 = request.getParameter("email1");
    String email = e2+"@"+e1;
    String job = request.getParameter("job");
    String PASS = request.getParameter("PASS");
    
    
    String str = "";

    // 여기까지

    
    
    try {
    
    Class.forName("oracle.jdbc.driver.OracleDriver");  //oracle드라이버 로드
    Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20162511","971204");  // 주소, 계정 틀리면 오류임
    PreparedStatement pstmt=conn.prepareStatement("insert into member(id,NAME,ymd,email,job,PASS) values(?,?,?,?,?,?)"); // 계정정보를 conn에 추가, 테이블에 있는 정보를 순서대로 추가
    pstmt.setString(1, id); // setString해줌
    pstmt.setString(2, NAME); // setString해줌
    pstmt.setString(3, ymd); // setString해줌
    
    pstmt.setString(4, email);
    pstmt.setString(5, job);
    pstmt.setString(6, PASS);
    
    pstmt.executeUpdate(); // 입력받았던 걸 업데이트해줌
    pstmt.close(); // close
    conn.close(); // close
    
    str = "회원가입 완료했습니다."; // 성공시 메시지 출력
    }catch(Exception e) {
    	e.printStackTrace();
    	str="회원가입 실패!"; // 실패시 메시지 출력
    }
    
    
    %>
    
    
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body bgcolor="#aee19b"style="text-align:center;">
 <jsp:include page="Head.jsp" /><br>
<%=str %>
</body>
</html>