<%@ 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 PASSWORD = request.getParameter("PASSWORD");
   String NAME = request.getParameter("NAME");
   String EMAIL = request.getParameter("EMAIL");
   String PHONENUM = request.getParameter("PHONENUM");
   
      
   String str = "";
   
   try
   {
	 
	   Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20172300","980612");
		PreparedStatement pstmt = conn.prepareStatement("insert into O_MEMBER(ID, PASSWORD, NAME, EMAIL, PHONENUM) values(?, ?, ?, ?, ?)");
		pstmt.setString(1, ID);
		pstmt.setString(2, PASSWORD);
		pstmt.setString(3, NAME);
		pstmt.setString(4, EMAIL);
		pstmt.setString(5, PHONENUM);
		
		pstmt.executeUpdate();
		pstmt.close();
		conn.close();  
	 	 
 	 str = "O_MEMBER 테이블에 새로운 레코드 추가에 성공했습니다.";
 	}
   catch(Exception e)
   { 
 		e.printStackTrace();
 		str = "O_MEMBER 테이블에 새로운 레코드 추가에 실패했습니다";
	
 	}
 %>
<html>
<head>
<title>레코드 추가</title>
</head>
<body>

  <%=str %>  <p>
<form method = "post" action = "loginForm.jsp">
<input type = submit value = "로그인"> 
<form method = "post" action = "inputForm.jsp">
<input type = submit value = "회원가입">
</body>
</html>