<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

    統(tǒng)計

    留言簿(23)

    積分與排名

    優(yōu)秀學習網(wǎng)站

    友情連接

    閱讀排行榜

    評論排行榜

    mysql數(shù)據(jù)庫備份與恢復程序

    mysql數(shù)據(jù)庫備份與恢復程序 ?
    <%@?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>數(shù)據(jù)不能正確備份,請稍后再試,或與管理員聯(lián)系。<a?href=#?onclick='history.go(-1)'>返回</a></p>");
    ????else{
    ????????out.println("<br><br><p?align=center>數(shù)據(jù)備份成功。<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>數(shù)據(jù)不能正確恢復,請稍后再試,或與管理員聯(lián)系。<a?href=#?onclick='history.go(-1)'>返回</a></p>");
    ????else{
    ????????out.println("<br><br><p?align=center>數(shù)據(jù)恢復成功。<a?href=#?onclick='history.go(-1)'>返回</a></p>");
    ????????action="main";
    ????}
    ????out.close();
    }
    if?("main".equals(action)){
    %>
    <script?language="javascript">
    ????//?表單提交(當遠程上傳完成后,觸發(fā)此函數(shù))
    ????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>備份系統(tǒng)數(shù)據(jù)庫</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="?備?份?數(shù)?據(jù)?"?onclick="doSubmit('backup')">???<input?type=button?value="?恢?復?數(shù)?據(jù)?"?onclick="doSubmit('restore')"></td>?
    ????</tr>?
    ??</form>?
    </table>?
    <%
    }
    %>

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

    主站蜘蛛池模板: 国产成人免费高清激情明星| h视频在线免费观看| 2021国内精品久久久久精免费| 国产亚洲一区二区三区在线不卡| 国产成人亚洲精品电影| 免费看又爽又黄禁片视频1000| 亚洲精品天堂在线观看| 四虎永久在线观看免费网站网址| 亚洲视频在线观看视频| 国产精品成人免费福利| 亚洲剧情在线观看| 免费人成在线观看69式小视频| 亚洲人成网站日本片| 成年女人午夜毛片免费看| 亚洲av无码兔费综合| 亚洲国产精品成人网址天堂| 国产免费MV大全视频网站| 精品亚洲综合久久中文字幕| 亚洲成人免费在线| 亚洲乱码日产精品BD在线观看| 成年丰满熟妇午夜免费视频| 婷婷国产偷v国产偷v亚洲| 国产91精品一区二区麻豆亚洲| 在线成人精品国产区免费| 久久久亚洲欧洲日产国码二区| 黄色片在线免费观看| 老司机午夜在线视频免费观| 在线播放亚洲第一字幕| 久久精品免费电影| 日本亚洲免费无线码 | 亚洲精品久久无码| 亚洲一区二区三区在线播放| 爱丫爱丫影院在线观看免费| 亚洲乱码卡一卡二卡三| 免费看国产一级特黄aa大片| 你懂得的在线观看免费视频| 亚洲人成网站日本片| 亚洲国产精品碰碰| 67194成手机免费观看| 麻豆亚洲AV成人无码久久精品 | 日韩在线一区二区三区免费视频|