Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit dfec1e2.
- Loading branch information
Showing
27 changed files
with
1,312 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_152"> | ||
<attributes> | ||
<attribute name="owner.project.facets" value="java"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0"> | ||
<attributes> | ||
<attribute name="owner.project.facets" value="jst.web"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> | ||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> | ||
<classpathentry kind="output" path="build/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Pro-db</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.common.project.facet.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.validation.validationbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> | ||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> | ||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/> | ||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> | ||
<attributes> | ||
<attribute name="hide" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> | ||
<classpathentry kind="output" path=""/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> | ||
<wb-module deploy-name="Pro-db"> | ||
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/> | ||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/> | ||
<property name="context-root" value="Pro-db"/> | ||
<property name="java-output-path" value="/Pro-db/build/classes"/> | ||
</wb-module> | ||
</project-modules> |
10 changes: 10 additions & 0 deletions
10
Pro-db/.settings/org.eclipse.wst.common.project.facet.core.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<faceted-project> | ||
<runtime name="Apache Tomcat v8.0"/> | ||
<fixed facet="jst.web"/> | ||
<fixed facet="java"/> | ||
<fixed facet="wst.jsdt.web"/> | ||
<installed facet="java" version="1.8"/> | ||
<installed facet="jst.web" version="3.1"/> | ||
<installed facet="wst.jsdt.web" version="1.0"/> | ||
</faceted-project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Class-Path: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Context> | ||
|
||
<Resource | ||
name="jdbc/OracleDB" | ||
auth="Container" | ||
driverClassNAme="oracle.jdbc.driver.OracleDriver" | ||
type="javax.sql.DataSource" | ||
url="jdbc:oracle:thin:@localhost:1521:TestDB" | ||
username="jerry" | ||
password="1111" | ||
maxActive="20" | ||
maxIdle="10" | ||
maxWait="-1" /> | ||
|
||
|
||
</Context> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> | ||
<display-name>Pro-db</display-name> | ||
<welcome-file-list> | ||
<welcome-file>index.html</welcome-file> | ||
<welcome-file>index.htm</welcome-file> | ||
<welcome-file>index.jsp</welcome-file> | ||
<welcome-file>default.html</welcome-file> | ||
<welcome-file>default.htm</welcome-file> | ||
<welcome-file>default.jsp</welcome-file> | ||
</welcome-file-list> | ||
|
||
<resource-ref> | ||
<description>Connection</description> | ||
<res-ref-name>jdbc/OracleDB</res-ref-name> | ||
<res-type>javax.sql.DataSource</res-type> | ||
<res-auth>Container</res-auth> | ||
</resource-ref> | ||
|
||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<%@ page language="java" contentType="text/html; charset=EUC-KR" | ||
pageEncoding="EUC-KR"%> | ||
<%@ page import="java.sql.*"%> | ||
<%@ page import="javax.sql.*"%> | ||
<%@ page import="javax.naming.*"%> | ||
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> | ||
<title>Insert title here</title> | ||
</head> | ||
<body> | ||
<% | ||
Connection conn = null; | ||
String sql= "INSERT INTO student (num,name) VALUES (6,'홍길동')"; | ||
try{ | ||
Context init = new InitialContext(); | ||
//connection pool에서 설정된 경로, java 경로에 들어있는 context.xml의 name인 jdbc/OracleDB의 경로를 가져옴 | ||
DataSource ds = (DataSource) init.lookup("java:comp/env/jdbc/OracleDB"); | ||
//내 db 경로를 가져와서 접속함 | ||
conn = ds.getConnection(); | ||
Statement stmt = conn.createStatement(); | ||
int result=stmt.executeUpdate(sql); | ||
if(result!=0){ | ||
out.println("<h3>레코드가 등록되었습니다.</h3>"); | ||
} | ||
}catch(Exception e){ | ||
out.println("<h3>레코드 등록에 실패하였습니다.</h3>"); | ||
e.printStackTrace(); | ||
} | ||
%> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<%@ page language="java" contentType="text/html; charset=EUC-KR" | ||
pageEncoding="EUC-KR"%> | ||
<%@ page import="java.sql.*"%> | ||
<%@ page import="javax.sql.*"%> | ||
<%@ page import="javax.naming.*"%> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> | ||
<title>Insert title here</title> | ||
</head> | ||
<body> | ||
<% | ||
request.setCharacterEncoding("UTF-8"); | ||
String pwd = (String) request.getParameter("my_pwd"); | ||
String mail = (String) request.getParameter("my_mail"); | ||
String chk = (String) request.getParameter("chk"); | ||
String intro = (String) request.getParameter("my_intro"); | ||
Connection conn = null; | ||
String sql = "UPDATE jointest SET pwd='" + pwd + "', mail='" + mail + "',chk='" | ||
+ chk + "',intro='" + intro + "' WHERE id='" + session.getAttribute("id") + "'"; | ||
try { | ||
System.out.println("-------------트라이------------------"); | ||
//context.xml 불러오기 | ||
Context init = new InitialContext(); | ||
//connection pool에서 설정된 경로, java 경로에 들어있는 context.xml의 name인 jdbc/OracleDB의 경로를 가져옴 | ||
DataSource ds = (DataSource) init.lookup("java:comp/env/jdbc/OracleDB"); | ||
//내 db 경로를 가져와서 접속함 | ||
conn = ds.getConnection(); | ||
PreparedStatement pstmt = conn.prepareStatement(sql); | ||
pstmt.executeUpdate(); | ||
ResultSet rs = pstmt.executeQuery(); | ||
rs.close(); | ||
response.sendRedirect("output.jsp"); | ||
System.out.println("-------------연결완료------------------"); | ||
out.println("<h3>연결되었습니다.</h3>"); | ||
} catch (Exception e) { | ||
out.println("<h3>연결에 실패하였습니다.</h3>"); | ||
e.printStackTrace(); | ||
}finally{ | ||
conn.close(); | ||
} | ||
System.out.println("-------------리다이렉트--------------------"); | ||
%> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<%@ page language="java" contentType="text/html; charset=EUC-KR" | ||
pageEncoding="EUC-KR"%> | ||
<%@ page import="java.sql.*"%> | ||
<% | ||
//내 db 접속에 사용할 conn 변수 | ||
Connection conn = null; | ||
//오라클 드라이버 경로 설정 | ||
String driver = "oracle.jdbc.driver.OracleDriver"; | ||
//내 db의 계정 경로 설정 | ||
String url = "jdbc:oracle:thin:@localhost:1521:TestDB"; | ||
//접속 성공,실패 여부 사용시 쓰는 변수 | ||
Boolean connect = false; | ||
//db 접속 코드는 반드시 try~catch문 안에 써줘야함 | ||
try { | ||
//오라클 드라이버 접속 | ||
Class.forName(driver); | ||
//내 db 접속 | ||
conn = DriverManager.getConnection(url, "jerry", "1111"); | ||
//접속성공시 true 설정 | ||
connect = true; | ||
//접속 끊기, 끊는 이유 : 항상 db가 연결되어 있으면 접속 오류 및 데이터 충돌이 일어나기 때문 | ||
conn.close(); | ||
} catch (Exception e) { | ||
//접속 실패시 false 잡고 예외처리해줌 | ||
connect = false; | ||
e.printStackTrace(); | ||
} | ||
%> | ||
<% | ||
if(connect==true){%> | ||
연결되었습니다. | ||
<%}else{ %> | ||
연결에 실패하였습니다. | ||
<%}%> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<%@ page language="java" contentType="text/html; charset=UTF-8" | ||
pageEncoding="EUC-KR"%> | ||
<%@ page import="java.sql.*"%> | ||
<%@ page import="javax.sql.*"%> | ||
<%@ page import="javax.naming.*"%> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> | ||
<title>회원가입 데이터를 db안에 넣기</title> | ||
</head> | ||
<body> | ||
<% request.setCharacterEncoding("UTF-8"); | ||
//회원가입할때 모든 정보를 가져오기 | ||
String id = (String) request.getParameter("my_id"); | ||
String pwd = (String) request.getParameter("my_pwd"); | ||
String mail = (String) request.getParameter("my_mail"); | ||
String name = (String) request.getParameter("my_name"); | ||
String num1 = (String) request.getParameter("my_num1"); | ||
String num2 = (String) request.getParameter("my_num2"); | ||
String year = (String) request.getParameter("my_year"); | ||
String month = (String) request.getParameter("month"); | ||
String day = (String) request.getParameter("day"); | ||
String chk = (String) request.getParameter("chk"); | ||
String intro = (String) request.getParameter("my_intro"); | ||
//세션 스코프에 내 id 정보 넣어서 session에 등록 | ||
request.getSession().setAttribute("id", id); | ||
//db 접속할 객체 만들기 | ||
Connection conn = null; | ||
//회원가입해서 db에 추가할 쿼리문 | ||
String sql = "INSERT INTO jointest values ('" + id + "'," + "'" + pwd + "'," | ||
+ "'" + mail + "'," + "'" + name + "'," + "'" + num1 + "'," + "'" + num2 + "'," | ||
+ "'" + year + "'," + "'" + month + "'," + "'" + day + "'," + "'" + chk + "'," | ||
+ "'" + intro + "')"; | ||
try { | ||
System.out.println("-------------트라이------------------"); | ||
//context.xml 불러오기 | ||
Context init = new InitialContext(); | ||
//connection pool에서 설정된 경로, java 경로에 들어있는 context.xml의 name인 jdbc/OracleDB의 경로를 가져옴 | ||
DataSource ds = (DataSource) init.lookup("java:comp/env/jdbc/OracleDB"); | ||
//내 db 경로를 가져와서 접속함 | ||
conn = ds.getConnection(); | ||
//db에 sql문 보내기 | ||
PreparedStatement pstmt = conn.prepareStatement(sql); | ||
//db 업데이트 | ||
pstmt.executeUpdate(); | ||
System.out.println("-------------연결완료------------------"); | ||
out.println("<h3>연결되었습니다.</h3>"); | ||
} catch (Exception e) { | ||
out.println("<h3>연결에 실패하였습니다.</h3>"); | ||
e.printStackTrace(); | ||
}finally{ | ||
conn.close(); | ||
} | ||
System.out.println("-------------리다이렉트------------------"); | ||
//db에 데이터를 전부 넣으면 main 화면으로 이동 | ||
response.sendRedirect("main.jsp"); | ||
%> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.