<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Dict.CN 在線詞典, 英語學習, 在線翻譯

    都市淘沙者

    荔枝FM Everyone can be host

    統計

    留言簿(23)

    積分與排名

    優秀學習網站

    友情連接

    閱讀排行榜

    評論排行榜

    mysql數據庫備份與恢復程序

    mysql數據庫備份與恢復程序 ?
    <%@?page?contentType="text/html;charset=gb2312"%>?
    <%@?page?import="java.util.*,com.fxm.common.*,com.ncucec.*,com.ncucec.dbo.*,java.sql.*,org.hibernate.*"%>

    <body>
    <%
    int?j=0;
    String?action,postid,folder;

    action?=?request.getParameter("action");
    postid?=?request.getParameter("postid");
    if?((action==null)?||?("".equals(action)))?action="main";
    if?((null==postid)?||?("".equals(postid)))?postid="0";

    String?path,realPath,sql,file,err;
    boolean?ret=false;


    if?("backup".equals(action)){
    ????path?=?CnUtils.toChinese(request.getParameter("path"));
    ????if?(CnUtils.isEmpty(path))?path?="";?else?path=DirList.getRealDir(path);
    ????//得到查詢的絕對路徑
    ????realPath?=?getServletContext().getRealPath(path);
    ????
    ????try{
    ????????//得到路徑
    ????????ret?=?DirList.MakeDir(realPath);
    ????????path?=?realPath+"\\"+DateUtil.formatDate(new?java.util.Date(),"yyMMdd");
    ????????ret?=?DirList.MakeDir(path);
    ????????path?=?CnUtils.Replace(path,"\\","/");

    ????????Session?ss?=?HibernateUtil.currentSession();
    ????????Transaction?tx?=?ss.beginTransaction();
    ????????Connection?conn=?ss.connection();
    ????????Statement?st?=?conn.createStatement();

    ????????file?=?path+"/news.txt";
    ????????sql?=?"select?*?from?tbl_news_b?into?outfile?'"+?file?+"'";
    ????????st.execute(sql);
    ????????
    ????????file?=?path+"/column.txt";
    ????????sql?=?"select?*?from?tbl_column_b?into?outfile?'"+?file?+"'";
    ????????st.execute(sql);

    ????????file?=?path+"/invinfo.txt";
    ????????sql?=?"select?*?from?tbl_invinfo_r?into?outfile?'"+?file?+"'";
    ????????st.execute(sql);

    ????????file?=?path+"/vote.txt";
    ????????sql?=?"select?*?from?tbl_vote_r?into?outfile?'"+?file?+"'";
    ????????st.execute(sql);

    ????????file?=?path+"/placard.txt";
    ????????sql?=?"select?*?from?tbl_placard_b?into?outfile?'"+?file?+"'";
    ????????st.execute(sql);

    ????????file?=?path+"/group.txt";
    ????????sql?=?"select?*?from?tbl_group_r?into?outfile?'"+?file?+"'";
    ????????st.execute(sql);

    ????????file?=?path+"/user.txt";
    ????????sql?=?"select?*?from?tbl_user_b?into?outfile?'"+?file?+"'";
    ????????st.execute(sql);


    ????????ret?=?true;
    ????????conn.commit();
    ????}catch(Exception?e){
    ????????out.println(e);
    ????????ret?=?false;
    ????}
    ????if?(ret==false)
    ????????out.println("<br><br><p?align=center>數據不能正確備份,請稍后再試,或與管理員聯系。<a?href=#?onclick='history.go(-1)'>返回</a></p>");
    ????else{
    ????????out.println("<br><br><p?align=center>數據備份成功。<a?href=#?onclick='history.go(-1)'>返回</a></p>");
    ????????action="main";
    ????}
    ????out.close();
    }
    if?("restore".equals(action)){
    ????path?=?CnUtils.toChinese(request.getParameter("path"));
    ????if?(CnUtils.isEmpty(path))?path?="";?else?path=DirList.getRealDir(path);
    ????//得到查詢的絕對路徑
    ????realPath?=?getServletContext().getRealPath(path);
    ????
    ????try{
    ????????//得到路徑
    ????????ret?=?DirList.MakeDir(realPath);
    ????????path?=?realPath+"\\"+DateUtil.formatDate(new?java.util.Date(),"yyMMdd");
    ????????ret?=?DirList.MakeDir(path);
    ????????path?=?CnUtils.Replace(path,"\\","/");

    ????????Session?ss?=?HibernateUtil.currentSession();
    ????????Transaction?tx?=?ss.beginTransaction();
    ????????Connection?conn=?ss.connection();
    ????????Statement?st?=?conn.createStatement();

    ????????file?=?path+"/column.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_column_b";
    ????????st.execute(sql);
    ????????
    ????????file?=?path+"/news.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_news_b";
    ????????st.execute(sql);
    ????????
    ????????file?=?path+"/vote.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_vote_r";
    ????????st.execute(sql);
    ????????
    ????????file?=?path+"/placard.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_placard_b";
    ????????st.execute(sql);
    ????????
    ????????file?=?path+"/invinfo.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_invinfo_r";
    ????????st.execute(sql);

    ????????file?=?path+"/template.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_template_r";
    ????????st.execute(sql);

    ????????file?=?path+"/group.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_group_r";
    ????????st.execute(sql);

    ????????file?=?path+"/user.txt";
    ????????sql?=?"load?data?infile?'"+file+"'?replace?into?table?tbl_user_r";
    ????????st.execute(sql);

    ????????ret?=?true;
    ????????conn.commit();
    ????}catch(Exception?e){
    ????????out.println(e);
    ????????ret?=?false;
    ????}
    ????if?(ret==false)
    ????????out.println("<br><br><p?align=center>數據不能正確恢復,請稍后再試,或與管理員聯系。<a?href=#?onclick='history.go(-1)'>返回</a></p>");
    ????else{
    ????????out.println("<br><br><p?align=center>數據恢復成功。<a?href=#?onclick='history.go(-1)'>返回</a></p>");
    ????????action="main";
    ????}
    ????out.close();
    }
    if?("main".equals(action)){
    %>
    <script?language="javascript">
    ????//?表單提交(當遠程上傳完成后,觸發此函數)
    ????function?doSubmit(type){
    ????????document.a1.action.value?=?type;
    ????????document.a1.submit();
    ????}
    </script>

    <table?width="550"?cellspacing=1?cellpadding=1?align=center?style="border:?1?solid?#808080"?border="0">?
    ??<tr>?
    ????<th?height=25>???<B>備份系統數據庫</B></th>?
    ??</tr>?
    ??<form?method="post"?action="?"?id=a1?name=a1>?
    ??<input?type=text?name="action"?value="backup">
    ????<tr>?
    ??????<td?bgcolor="ffffff"?height="22">?備份目錄:?
    ????????<input?type=text?size=20?name="path"?value="backup"></td>?
    ????</tr>?
    ????<tr>?
    ??????<td?bgcolor="efefef"?height="25">??
    ????????<input?type=button?value="?備?份?數?據?"?onclick="doSubmit('backup')">???<input?type=button?value="?恢?復?數?據?"?onclick="doSubmit('restore')"></td>?
    ????</tr>?
    ??</form>?
    </table>?
    <%
    }
    %>

    posted on 2006-04-25 17:00 都市淘沙者 閱讀(563) 評論(0)  編輯  收藏 所屬分類: Oracle/Mysql/Postgres/

    主站蜘蛛池模板: 亚洲AV无码久久精品色欲| 亚洲人成未满十八禁网站| 日韩免费码中文在线观看| xxxx日本免费| 亚洲精品色午夜无码专区日韩| 亚洲综合偷自成人网第页色| 国产成人精品免费久久久久| 亚洲成人影院在线观看| 精品亚洲AV无码一区二区三区| 鲁丝片一区二区三区免费| 亚洲国产成人久久综合野外| 亚洲性无码一区二区三区| 久久w5ww成w人免费| 亚洲毛片αv无线播放一区| 精品免费AV一区二区三区| 亚洲免费综合色在线视频| 亚洲伦理一区二区| a级毛片毛片免费观看久潮喷 | 男人的好看免费观看在线视频| 亚洲成人动漫在线| 青青操免费在线视频| 亚洲AV无码专区日韩| 亚洲AV日韩AV一区二区三曲| 免费一本色道久久一区| 亚洲国产精品张柏芝在线观看| 久久精品私人影院免费看| 亚洲精品无码鲁网中文电影| 一级毛片视频免费| 亚洲黄片手机免费观看| 福利片免费一区二区三区| 国产美女精品久久久久久久免费| 成人区精品一区二区不卡亚洲| 99久久国产热无码精品免费 | 亚洲自偷自偷偷色无码中文| 又长又大又粗又硬3p免费视频| 又大又粗又爽a级毛片免费看| 亚洲av中文无码字幕色不卡| 天天摸天天碰成人免费视频| 最新国产精品亚洲| 成人无遮挡裸免费视频在线观看| 2020亚洲男人天堂精品|