ych

          2007年7月6日

          通過exp導出與imp導入進行數據的備份轉移:
          exp命令:
          1 exp username/psw@TEST file=d:test.dmp full=y
          2 exp username/psw@TEST file=d:test.dmp owner=(ly)
          3 exp username/psw@TEST file= d:test.dmp tables=(grid1,grid2)
          1其中一是將Test(與某一數據庫對應的oracle服務名)數據庫進行整體導出
          2將屬于用戶ly的所有表導出
          3將表grid1,與grid2導出
          d:test.dmp是導出的文件地址

          imp命令:
          1 imp system/psw@TEST  file=d:test.dmp
          2 imp system/psw@TEST  full=y  file=d:test.dmp ignore=y
          3 imp system/psw@TEST  file=d:test.dmp  tables=(grid1)
          ignore=y表示如果被導入的數據庫中某個表已經存在就忽略不導入那個表
          3表示只導入grid1這個表

          在導入導出前要先測試下對應的數據庫是否是通的:tnsping test來測試,同樣test是服務名
          所有命令可在cmd下執行
          posted @ 2008-09-03 11:57 changhong 閱讀(97) | 評論 (0)編輯 收藏

          http://blog.csdn.net/techyang/archive/2005/08/09/448677.aspx(luanfengxia/arc/2006/05/20/746951.aspx)

           public ActionForward add(ActionMapping mapping, ActionForm form,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
                  String encoding = request.getCharacterEncoding();
                  if ((encoding != null) && (encoding.equalsIgnoreCase("utf-8")))
                  {
                      response.setContentType("text/html; charset=gb2312");//如果沒有指定編碼,編碼格式為gb2312
                  }
                  NodeForm theForm = (NodeForm) form;
                  String nodename=theForm.getNodename();
                  String note=theForm.getNote();
                  FormFile file = theForm.getTheFile1();//取得上傳的文件
                  FormFile file2=theForm.getTheFile2();
                  FormFile file3=theForm.getTheFile3();
                  Session session=null;
                  String forward="";
                  try
                  {
                      /*
                       * 取當前系統路徑
                       */
                      String filePath = this.getServlet().getServletContext()
                      .getRealPath("/");
                      System.out.println("---------------------------------------"+filePath);
                      if(file.getFileSize()!=0){
                      ByteArrayInputStream stream = (ByteArrayInputStream) file.getInputStream();//把文件讀入
                    
                      //ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    
                      /*
                       * 建立一個上傳文件的輸出流
                       */
                      OutputStream bos = new FileOutputStream(filePath +
                              "UploadFiles\\"+file.getFileName());
                      request.setAttribute("fileName",filePath + "/"
                              + file.getFileName());
                      int bytesRead = 0;
                      byte[] buffer = new byte[8192];
                      while ((bytesRead = stream.read(buffer, 0, 8192)) != -1)
                      {
                          bos.write(buffer, 0, bytesRead);//將文件寫入服務器
                      }          
                      bos.close();
                      stream.close();
                      }if(file2.getFileSize()!=0){
                      ByteArrayInputStream stream2 = (ByteArrayInputStream) file2.getInputStream();
                      OutputStream bos2 =  new FileOutputStream(filePath +
                              "UploadFiles\\"+file2.getFileName());//建立一個上傳文件的輸出流
                      int bytesRead2 = 0;
                      byte[] buffer2 = new byte[8192];
                      while ((bytesRead2 = stream2.read(buffer2, 0, 8192)) != -1)
                      {
                          bos2.write(buffer2, 0, bytesRead2);//將文件寫入服務器
                      }          
                      bos2.close();
                      stream2.close();
                      }if(file3.getFileSize()!=0){
                      ByteArrayInputStream stream3 = (ByteArrayInputStream) file3.getInputStream();//把文件讀入
                  OutputStream bos3 =  new FileOutputStream(filePath +
                          "UploadFiles\\"+file3.getFileName());//建立一個上傳文件的輸出流
                  int bytesRead3 = 0;
                  byte[] buffer3 = new byte[8192];

                  while ((bytesRead3 = stream3.read(buffer3, 0, 8192)) != -1)
                  {
                      bos3.write(buffer3, 0, bytesRead3);//將文件寫入服務器
                  }          
                  bos3.close();
                  stream3.close();
                  }
            Configuration config = new Configuration().configure();
            SessionFactory factory = config.buildSessionFactory();
               session = factory.openSession();
                  Transaction transaction = session.beginTransaction();
                  Node node=new Node();
                  node.setNodeName(nodename);
                  node.setXsdName(file.getFileName());
                  node.setXslName(file2.getFileName());
                  node.setXhtmlName(file3.getFileName());
                  node.setNote(note);
                  session.save(node);
            session.flush();
            session.clear();
            forward="display";
                  transaction.commit();
                  }
                  catch (Exception e)
                  {
                   forward="error";
                      System.err.print(e);
                      e.printStackTrace();
                  }
             
            finally{
             session.close();
             }
                  return mapping.findForward(forward);
           }

          posted @ 2007-08-29 13:35 changhong 閱讀(208) | 評論 (0)編輯 收藏
          "^\\d+$"  //非負整數(正整數 + 0)
          "^[0-9]*[1-9][0-9]*$"  //正整數
          "^((-\\d+)|(0+))$"  //非正整數(負整數 + 0)
          "^-[0-9]*[1-9][0-9]*$"  //負整數
          "^-?\\d+$"    //整數
          "^\\d+(\\.\\d+)?$"  //非負浮點數(正浮點數 + 0)
          "^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$"  //正浮點數
          "^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$"  //非正浮點數(負浮點數 + 0)
          "^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"  //負浮點數
          "^(-?\\d+)(\\.\\d+)?$"  //浮點數
          "^[A-Za-z]+$"  //由26個英文字母組成的字符串
          "^[A-Z]+$"  //由26個英文字母的大寫組成的字符串
          "^[a-z]+$"  //由26個英文字母的小寫組成的字符串
          "^[A-Za-z0-9]+$"  //由數字和26個英文字母組成的字符串
          "^\\w+$"  //由數字、26個英文字母或者下劃線組成的字符串
          "^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$"    //email地址
          "^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$"  //url
          posted @ 2007-07-06 19:14 changhong 閱讀(136) | 評論 (0)編輯 收藏

          導航

          <2007年7月>
          24252627282930
          1234567
          891011121314
          15161718192021
          22232425262728
          2930311234

          統計

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 岫岩| 延寿县| 白城市| 玛曲县| 江山市| 乌兰浩特市| 金堂县| 天等县| 鄯善县| 鄂州市| 怀仁县| 清流县| 措勤县| 大宁县| 休宁县| 巫山县| 蒲江县| 钦州市| 隆安县| 宜良县| 临沂市| 于田县| 阳山县| 偃师市| 德兴市| 米泉市| 安岳县| 乐清市| 宣武区| 山东省| 镇康县| 永康市| 北流市| 五台县| 德格县| 青川县| 交口县| 朝阳县| 林甸县| 武穴市| 鲁甸县|