<%@ 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");%>

<html>
<head>
<title>레코드 추가</title>
</head>
<body>
<center>
<form>
<% 
   String id = request.getParameter("id");
   String passwd= request.getParameter("passwd");
   String username = request.getParameter("username");  
   String year = request.getParameter("year");
   String address = request.getParameter("address");
   String email = request.getParameter("email");
   String job = request.getParameter("job");
      
   String str="";
   
   try{
	 
	   Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20182209","961127");
		PreparedStatement pstmt=conn.prepareStatement("insert into CHANGMIN(id,passwd,username,year,address,email,job) values(?,?,?,?,?,?,?)");
		pstmt.setString(1, id);
		pstmt.setString(2, passwd);
		pstmt.setString(3, username);
		pstmt.setString(4, year);
		pstmt.setString(5, address);
		pstmt.setString(6, email);
		pstmt.setString(7, job);
		
		pstmt.executeUpdate();
		pstmt.close();
		conn.close();  
	 	 
 	str= "CHANGMIN 홈페이지에 회원을 추가하였습니다.";
 	}catch(Exception e){ 
 		e.printStackTrace();
 		str="CHANGMIN 테이블에 새로운 레코드를 추가에 실패했습니다";
	
 	}
 %>

  <%=str %>  <p>
  
 <A href="http://localhost:8080/f/list.jsp">전체회원목록 </A>
 <A href="http://localhost:8080/f/loginForm.jsp">로그인 </A>
 <A href="http://localhost:8080/f/deleteForm.jsp">회원탈퇴 </A>
  </form>
</body>
</center>
</html>