<%@ 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");
   String year = request.getParameter("year");
   String month = request.getParameter("month");
   String day = request.getParameter("day");
   String address = request.getParameter("address");
   String userEmail = request.getParameter("userEmail");
   
   String str="";
   
   try{
	 
	    Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20162496","980216");
		PreparedStatement pstmt=conn.prepareStatement("insert into MEMBER_TABLE(id,passwd,name,year,month,day,address,userEmail) values(?,?,?,?,?,?,?,?)");
		pstmt.setString(1, id);
		pstmt.setString(2, passwd);
		pstmt.setString(3, name);
		pstmt.setString(4, year);
		pstmt.setString(5, month);
		pstmt.setString(6, day);
		pstmt.setString(7, address);
		pstmt.setString(8, userEmail);
		
		pstmt.executeUpdate();
		pstmt.close();
		conn.close();  
	 	 
 	 str= "회원가입 성공!";
 	}catch(Exception e){ 
 		e.printStackTrace();
 		str="오류가 발생했습니다. 다시 시도하세요.";
	
 	}
 %>
<html>
<head>
<title>메시지</title>
</head>
<body>
  <%=str %>  <p>
  
 <A href="http://localhost:8080/Project/main.jsp">메인으로 이동 </A>
  
</body>
</html>