Skip to content

Commit

Permalink
jsp test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaarden committed Nov 21, 2023
1 parent 0791a77 commit 16bb07f
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions KNU_MUSEUM/src/main/webapp/test_gaarden_1121.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page language="java" import="java.text.*,java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String serverIP = "localhost";
String strSID = "xe";
String portNum = "1521";
String user = "KNU_MUSEUM";
String pass = "comp322";
String url = "jdbc:oracle:thin:@"+serverIP+":"+portNum+":"+strSID;
String query = new String();
Connection conn = null;
PreparedStatement pstmt;
ResultSet rs;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url,user,pass);
%>

<h2>Connection Test</h2>

<%
//Q1
query = "SELECT EduID, Title " + "FROM MUSEUM_PROGRAM_LIST " + "WHERE Title LIKE '%미디어%'";
pstmt = conn.prepareStatement(query);
rs = pstmt.executeQuery();
out.println("<table border=\"1\">");
ResultSetMetaData rsmd = rs.getMetaData();
int cnt = rsmd.getColumnCount();
for(int i =1;i<=cnt;i++){
out.println("<th>"+rsmd.getColumnName(i)+"</th>");
}
while(rs.next()){
out.println("<tr>");
out.println("<td>" + rs.getString(1) + "</td>");
out.println("<td>" + rs.getString(2) + "</td>");
out.println("</tr>");
}
out.println("</table>");
%>



</body>
</html>

0 comments on commit 16bb07f

Please sign in to comment.