<%@ page language="java" contentType="text/html;charset=Shift_JIS" %>
<%@ page import="java.sql.*,
jp.co.toshiba.komukai.intrasys.jdbc.*,
jp.co.toshiba.komukai.intrasys.wui.*" %>
<%@ page pageEncoding="Shift_JIS" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="req" uri="http://jakarta.apache.org/taglibs/request-1.0" %>
<html><body>
<%
DbcmAdaptor adaptor = new DbcmSimpleAdaptor(
"oracle-thin", "falcon.center.nsnhnkmmkk.co.jp", 1521,
"kadb", "username", "password"
);
Dbcm d = new Dbcm(adaptor);
d.connect();
Connection con = d.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(
"SELECT * FROM CATALOG_ORDERS WHERE 1 = 2"
);
ResultSetMetaData rsmd = rset.getMetaData();
int colc = rsmd.getColumnCount();
%>
<table>
<%
String[] rowdata = new String[8];
for(int i=1; i<=colc; i++){
rowdata[0] = rsmd.getColumnName(i);
rowdata[1] = rsmd.getColumnClassName(i);
rowdata[2] = rsmd.getColumnTypeName(i);
rowdata[3] = String.valueOf(rsmd.getColumnDisplaySize(i));
rowdata[4] = String.valueOf(rsmd.getPrecision(i));
rowdata[5] = String.valueOf(rsmd.getScale(i));
rowdata[6] = String.valueOf(rsmd.isCaseSensitive(i));
rowdata[7] = String.valueOf(rsmd.isNullable(i));
// ↓columnLabelは一般にcolumnNameと同じ
//rowdata[2] = rsmd.getColumnLabel(i);
// 下の2つはclasses12.zipではサポートされていない
//rowdata[1] = rsmd.getCatalogName(i);
//rowdata[8] = rsmd.getTableName(i);
out.println("<tr>");
for(int c=0; c<rowdata.length; c++){
out.print("<td>" + rowdata[c] + "</td>");
}
out.println("\n</tr>");
}
%>
</table>
<%
rset.close();
st.close();
d.close();
%>
</body></html>
|