YEKongBob YEKongBob
关注数: 1 粉丝数: 8 发帖数: 64 关注贴吧数: 4
java实现oracle备份还原功能报错。。。。。 一,贴上代码 package com.test; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.FileChannel; import java.nio.channels.ReadableByteChannel; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * java 程序 导入导出数据库 做到程序定时 ( 结合 quartz,log) 自动备份,防止数据丢失 * * @author leiwei 2011 - 12 - 1 * */ @SuppressWarnings("unused") public class Backup { /** 用户名 */ private String userName; /** 密码 */ private String userPass; /** 服务地址 */ private String serverAddr; /** 备份文件路径 */ private String backupFilePath; /** 备份日志路径*/ private String logPath; /** * constructor * @param userName 数据库用户名 * @param userPass 数据库用户密码 * @param serverAddr 服务地址:端口/数据库名称 * @param backupFilePath 备份文件路径 */ public Backup(String Name, String Pass, String Addr, String FilePath,String log) { this.userName = Name; this.userPass = Pass; this.serverAddr = Addr; this.backupFilePath = FilePath; this.logPath = log; } /** * 获取命令串 * @param bool 是否为还原数据库的命令串 默认为获取备份命令 * @return commStr 命令串 */ private String GetCommand(boolean bool){ String commStr = "EXP @USER@/@PASSWORD@@@SERVER@ FILE=@FILEPATH@ LOG=@LOGPATH@ FULL=Y"; if(bool){ commStr = "IMP @USER@/@PASSWORD@@@SERVER@ FILE=@FILEPATH@ LOG=@LOGPATH@ FULL=Y"; } String temp = commStr.replaceAll("@USER@", this.userName).replaceAll("@PASSWORD@", this.userPass).replaceAll("@SERVER@", this.serverAddr).replaceAll("@FILEPATH@",this.backupFilePath).replaceAll("@LOGPATH@", this.logPath); System.out.println(temp); return temp; } /** * 备份或者还原数据库 * @param bool 真:还原数据库 假:备份数据库 * @return boolean */ public boolean expBackup(boolean bool) { Runtime rt = Runtime.getRuntime(); Process processexp = null; try { processexp = rt.exec(GetCommand(bool)); return true; } catch (IOException e) { e.printStackTrace(); } return false; } public static void main(String[] args) { Backup backup = new Backup("kjcb", "kjcb", "127.0.0.1:1521/orcl", "D:/BackupDatabase/backup.dmp", "D:/BackupDatabase/backup.log"); backup.GetCommand(false); backup.expBackup(false); } } 二,报错信息
在线急等!!属性“save”的值为 null、未定义或不是 Function <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>单位基本信息编辑修改页面</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <script type="text/javascript"> function save() { alert("Hello World!"); } </script> </head> <body> <div style="margin:10px 0;"></div> <form id="editform" name="editform" method="post" action="main!edit.action"> <table width="1081" border="1" align="center"> <th colspan="8"><h2>编辑表</h2></th> <tr> <td width="109">企业名称</td> <td width="166"><input type="text" name="editcompanyname" value="${companyname }" /></td> <td width="175">法定代表人</td> <td width="98"><input type="text" name="editfddbr" value="${fddbr }" /></td> <td width="113">职工总数</td> <td width="91"><input type="text" name="editmember" value="${member }" /></td> <td width="149">行业领域</td> <td width="128"><input type="text" name="editindustry" value="${industry }" /></td> </tr> <tr> <td>联系人</td> <td>${ contact }</td> <td>联系电话</td> <td>${ tel }</td> <td>销售收入</td> <td>&nbsp;</td> <td>研发(R&amp;D)投入</td> <td>&nbsp;</td> </tr> <tr> <td>企业类型</td> <td colspan="5"><p> <input type="checkbox" name="editqiyetype" id="checkbox1" />创新型(试点)企业 <input type="checkbox" name="editqiyetype" id="checkbox2" />高新技术企业 <input type="checkbox" name="editqiyetype" id="checkbox3" />知识产权优势企业 <input type="checkbox" name="editqiyetype" id="checkbox4" />省级龙头企业<br/> <input type="checkbox" name="editqiyetype" id="checkbox5" />科技型企业 <input type="checkbox" name="editqiyetype" id="checkbox6" />其他: <input type="text" name="textfield" id="textfield" value=${unid }/> </p></td> <s:checkboxlist name="sds" list="{'创新型(试点)企业','高新技术企业','知识产权优势企业','省级龙头企业','科技型企业','其他:'}" > </s:checkboxlist> <input type="text" name="textfield" id="textfield" value=${unid }/> <td>设立研发专账</td> <td><input type="checkbox" name="checkbox2" id="checkbox2" /> 是 <input type="checkbox" name="checkbox3" id="checkbox3" /> 否<label for="checkbox2"></label></td> </tr> <tr> <td>研发机构名称</td> <td>${ jgmc }</td> <td colspan="6"><input type="checkbox" name="checkbox9" id="checkbox9" /> 省级重点实验室 <input type="checkbox" name="checkbox10" id="checkbox10" /> 省级工程技术研究院 <input type="checkbox" name="checkbox11" id="checkbox11" /> 省级企业技术中心 <input type="checkbox" name="checkbox12" id="checkbox12" /> 其他</td> </tr> <tr> <td height="55" colspan="8" align="center"> <button type="submit" onclick="save()">点击这里</button> </td> </tr> </table> </form> </body> </html> 这只是一个简单的js方法调用怎么报这些怪问题呢????
1 下一页