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

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<% request.setCharacterEncoding("UTF-8");%>
<% 	
	String password = request.getParameter("password");
	String id = request.getParameter("id");
	String name = request.getParameter("name");
	
	Connection conn = null;
	PreparedStatement pstmt = null;
	String str = "";
	try{
		Class.forName("oracle.jdbc.driver.OracleDriver");
		 conn = DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl", "20182248","990623");
		 pstmt = conn.prepareStatement("insert into o_member(password,id,name) values(?,?,?)");
		    pstmt.setString(1,password);
			pstmt.setString(2,id);
			pstmt.setString(3,name);
	
			pstmt.executeUpdate();
			str = " 테이블에 새로운 레코드 추가 완료";	
	}
	catch (Exception e) {
		e.printStackTrace();
		str="o_member 테이블에 레코드 추가 실패";
	}finally{
		if(pstmt!=null)
			try{pstmt.close();}catch(SQLException se){}
		if(conn!=null)
			try{conn.close();}catch(SQLException se){}
	}
	%>
    	
    	사용자 ID:<%=id%><br>
    	비밀번호:<%=password%><br>
    	사용자 이름:<%=name%><br>
    	<%=str %>
    	<script>
    	alert("화원가입 완료!!!");
    	location.href="main.jsp";
    	</script>
          	</body>
          	</html>