<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.dbforeign.*" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ include file="/sessionInfo.jsp"%>
<html>
<body onload="load();">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
<%
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
    String sRelate = SzConvert.toSpaceStr(request.getParameter("relate"));
    String sObjectType = SzConvert.toSpaceStr(request.getParameter("ObjectType"));  
    DBReadSelectXMLdb readSelectXML = new DBReadSelectXMLdb();
    //获取已经设置的详细信息
    DBSelectDBinfo tableInfo = (DBSelectDBinfo)readSelectXML.getTableInfoFromXML(sRelate);
    if (tableInfo == null) {
    	tableInfo = new DBSelectDBinfo();
    	//tableInfo.setGLTJ("1=1");
    }
    if (sOPERATOR.equals("")) {
    	sOPERATOR = "set";    //share/formEngine2/index.jsp?FormID=1238 
    }
    String sFormType = (String)session.getAttribute("SzFormType");
 
%>

<form name="formUpdate" method="post" action="" >
<input type="hidden" name="OPERATOR" value="<%=sOPERATOR%>">
<input type="hidden" name="ObjectType" value="<%=sObjectType%>">
<input type="hidden" name="moduleName" value="<%=sFormType%>">
<input type="hidden" name="moduleName1" value="">
<input type="hidden" name="formName1" value="">
<input type="hidden" name="moduleName2" value="">
<input type="hidden" name="formName2" value="">
<table width="600" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass"
       cellpadding="3" cellspacing="0" align="center">  
  <tr>
    <td colspan="2">
    <%
    if (sOPERATOR.equals("set")) {
      String s_name[] = readSelectXML.getTableName();
    	out.println("请选择关联信息：");
    	out.println(SzPageHelp.idSelectArrayFunc(s_name, s_name, "relate", sRelate, "txtClass1", "SelectRelate();"));
    }
    %>  
    </td>
  </tr>  
       
  <tr>
    <td colspan="6" class="trClassTitle">==数据库连接信息设置==</td>
  </tr>         
  <tr>
  	<td>数据库配置名称</td>  
    <td><input type="text" value="<%=tableInfo.getRelateName() %>" name="relateName" class="txtClass2"></td>  
  </tr>
  <tr>
  	 <td >数据库配置说明</td>
    <td>  <input type="text" name="relateDesc" value="<%=tableInfo.getRelateDesc() %>"  class="txtClass2"></td>
  </tr>
   <tr>
  	<td>DRIVER</td>  
    <td><input type="text" value="<%=tableInfo.getDriver() %>" name="Driver" class="txtClass2"></td>  
  </tr>
   <tr>
  	<td>URL</td>  
    <td><input type="text" value="<%=tableInfo.getUrl() %>" name="Url" class="txtClass2"></td>  
  </tr>
   <tr>
  	<td>USER</td>  
    <td><input type="text" value="<%=tableInfo.getUser() %>" name="User" class="txtClass2"></td>  
  </tr>
   <tr>
  	<td>PASSWORD</td>  
    <td><input type="text" value="<%=tableInfo.getPassword() %>" name="Password" class="txtClass2"></td>  
  </tr>
  
  <tr>
    <td colspan="2" align="center"  class="trClassTitle">          
      <input type="button" value="保存" class="btnClass" OnClick="Save();">
      
      <input type="button" value="返回" class="btnClass" OnClick="javascript:history.go(-1);">
    </td>  
  </tr>    
</table>
<table width="600" border="0"  align="center">  
<tr>
  <td colspan="2"><b>(一)：连接外部mysql配置示例</b></td>
</tr>
<tr>  
  <td>DRIVER</td><td>org.gjt.mm.mysql.Driver</td>
</tr>
<tr>
  <td>URL</td><td>jdbc:mysql://localhost:3307/sz_groupoa</td>
</tr>
<tr>  
  <td>USER</td><td>root</td>
</tr>
<tr>  
  <td>PASSWORD</td><td>&nbsp;</td>
</tr>   
<tr>
  <td colspan="2"><b>(二)：连接外部sqlserver配置示例</b></td>
</tr>
<tr>  
  <td>DRIVER</td><td>com.microsoft.jdbc.sqlserver.SQLServerDriver</td>
</tr>
<tr>
  <td>URL</td><td>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=SZ_GROUPOA</td>
</tr>
<tr>  
  <td>USER</td><td>sa</td>
</tr>
<tr>  
  <td>PASSWORD</td><td>&nbsp;</td>
</tr>    
<tr>
  <td colspan="2"><b>(三)：连接外部Oracle配置示例</b></td>
</tr>
<tr>  
  <td>DRIVER</td><td>oracle.jdbc.driver.OracleDriver</td>
</tr>
<tr>
  <td>URL</td><td>jdbc:oracle:thin:@localhost:1521:SZGROUPOA</td>
</tr>
<tr>  
  <td>USER</td><td>oasa</td>
</tr>
<tr>  
  <td>PASSWORD</td><td>&nbsp;</td>
</tr>    
</table>
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
<script language="javascript" src="../../share/js/selectTool.js"></script>

<script language="javascript">
  
  //提交到控制保存的页面
  function Save() {
  	if (!notSpace(formUpdate.relateName, "名称")) {
      return false;
    }  
    //名称只能为字母数字下划线
    if (!isLetterOrNumOrLine(formUpdate.relateName.value)) {
      alert("名称只能是字母数字下划线");
      formUpdate.relateName.focus();
      return false;
    }
    if (!notSpace(formUpdate.Driver, "驱动")) {
      return false;
    }   
    if (!notSpace(formUpdate.Url, "url")) {
      return false;
    }   
    if (!notSpace(formUpdate.User, "用户名")) {
      return false;
    }   
      
    formUpdate.action = "foreign_db_control.jsp";
    formUpdate.submit();
  }
  
  //选择已经存在的，显示出来。
  function SelectRelate() { 
    formUpdate.action = "../../share/foreign/formselectdb.jsp";
    formUpdate.submit();  
  }
</script>

</body>
</html>
<!-- 
<iframe name="submitName" style='display:none;'></iframe>
 -->