%@ page language="java" contentType="text/html;charset=Shift_JIS" %>
<%@ page import="ushi.util.TableDefUtil" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sess" uri="http://jakarta.apache.org/taglibs/session-1.0" %>
<%
String dest = request.getParameter("dest").trim();
String tableName = request.getParameter("tableName").trim().toUpperCase();
String action = request.getParameter("action");
if(dest.equals("")){
%>
接続先を選んで下さい。
<%
} else if(tableName.equals("")){
%>
表(またはビュー)の名前を入力して下さい。
<%
} else if(tableName.indexOf(";") >= 0 || tableName.indexOf("<") >= 0 ||
tableName.indexOf(" ") >= 0){
%>
表(またはビュー)の名前を正しく入力して下さい。
<%
} else {
DbcmAdaptor adaptor;
if(dest.equals("dev1")){
adaptor = new DbcmSimpleAdaptor(
"oracle-thin", "falcon.center.nsnhnkmmkk.co.jp", 1521,
"MUDB", "dev1", "dev1coco");
}
else if(dest.equals("dev2")){
adaptor = new DbcmSimpleAdaptor(
"oracle-thin", "falcon.center.nsnhnkmmkk.co.jp", 1521,
"MUDB", "dev2", "dev2coco");
}
else if(dest.equals("dev3")){
adaptor = new DbcmSimpleAdaptor(
"oracle-thin", "falcon.center.nsnhnkmmkk.co.jp", 1521,
"MUDB", "dev3", "dev1coco");
}
else{
// cannot happen
throw new RuntimeException("cannot create dbcm adaptor.");
}
Dbcm d = new Dbcm(adaptor);
d.connect();
Connection con = d.getConnection();
String s;
if(action.equals("tableDef")){
s = TableDefUtil.getTableDefHTML(con, tableName);
} else if(action.equals("loader")){
s = TableDefUtil.getLoaderCtlDesc(con, tableName);
} else if(action.equals("select")){
s = TableDefUtil.getSelectStatement(con, tableName);
} else if(action.equals("insert")){
s = TableDefUtil.getInsertStatement(con, tableName);
} else {
throw new RuntimeException("the value of 'action' unexpected.");
}
d.close();
if(action.equals("tableDef")){
out.println("" + s + "
");
} else {
out.println("" + s + "
");
}
}
%>