<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.sql.*, java.util.*,java.text.*,javax.sql.*,javax.naming" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Contents-Type" content="text/html; charset=UTF-8">
<title>JSP Oracle JDBC CONN TEST</title>
</head>
<body>
<%
Connection conn = null;
Statement stmt;
ResultSet rs;
final String dataSource = "[jndi name]";
try {
Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup(dataSource);
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery( "SELECT sys_context('USERENV', 'DB_NAME') from dual");
out.println("WAS "+dataSource+" connect ok");
ResultSetMetaData rsmd = rs.getMetaData();
int colCnt = rsmd.getColumnCount();
StringBuffer sb = new StringBuffer();
sb.append("<table border='1' >");
sb.append("tr style='font-size : 13px; '>");
for(int i = 1; i <= colCnt; i++)
sb.append("<th>"+ rsmd.getColumnName(i) + "</th>");
sb.append("</tr>");
boolean row_flag = false;
while (rs.next()) {
row_flag = true;
sb.append("<tr style=font-size=12px;'>);
for(int i=1; i <= colCnt; i++)
sb.append("<td>" + rs.getString(rsmd.getColumnName(i)) + "</td>");
sb.append("</tr>");
}
if(row_flag == false)
sb.append("td colspan='" + colCnt + "</td>");
sb.append("</table>");
out.print(sb.toString());
rs.close();
stmt.close();
conn.close();
} catch(Exception e) {
out.println(e.getMessage());
}
%>
</body>
</html>
'IT > MiddleWare(WEB WAS)' 카테고리의 다른 글
[JEUS7,8]JEUSADMIN 콘솔 창 크기 조절 (0) | 2022.03.10 |
---|---|
[JEUS6]TM 로그로 인해 컨테이너 기동 실패 (0) | 2021.11.02 |
[링크]JEUS 설정 메뉴얼 (0) | 2021.10.19 |
[JEUS7,8]DAS를 통하지 않은 MS기동 (0) | 2021.10.19 |
[링크]URL REWRITE 가이드 (0) | 2021.09.27 |