zoukankan      html  css  js  c++  java
  • 更新oracle数据库中xml数据

    //更新图层元数据
     public  static  boolean  updateLayerMetadataByID(DataSource ds,String id,String xml)throws SQLException,ClassNotFoundException{
      boolean  flag=false;
      Connection con=null;
      try{
       String metadataTableName=DBUtil.getLayerMetadataTableName(ds);
       StringBuffer buffer=new StringBuffer("Update ");
       buffer.append(metadataTableName);
       buffer.append(" SET DATACOL = ? WHERE RECORDID = ?");
    //   buffer.append(id);
    //   buffer.append("'");
       con=DBUtil.getConnection(ds);
       logger.info("excute sql:"+buffer.toString());
       OraclePreparedStatement ste=(OraclePreparedStatement)con.prepareStatement(buffer.toString());
       XMLType xmltype=XMLType.createXML(con, xml);
       ste.setObject(1, xmltype);
       ste.setString(2, id);
       //boolean result = false;
       //try{
        ste.execute();
        flag = true;
        //_log.info("execute sql : " + sql.toString() + " successful.");
       //} finally {
        if(ste != null) {
         ste.close();
         ste = null;
        }
       //}    
      }catch(ClassNotFoundException e){
       flag=false;
       throw new ClassNotFoundException(e.getMessage());
      }catch(SQLException e){
       flag=false;
       throw new SQLException(e);
      }finally{
       try{
       DBUtil.closeConnection(con);
       }
       catch(SQLException e){
        flag=false;
        throw new SQLException(e);
       };
       
      }
      return flag;
      
     };

    转载请注明出处,欢迎交流!http://www.cnblogs.com/likehua

  • 相关阅读:
    使用django开发一个web项目初试
    关于github一些比较重要的命令
    删除github repository的方法
    Node、npm与Vue配置与问题记录
    [记忆]5月第二周
    git am patch冲突解决步骤
    git丢弃本地修改的几种方式
    Log4j 2.X 漏洞解决
    Maven依赖范围Scope及传递性依赖
    Mysql创建事件定时任务
  • 原文地址:https://www.cnblogs.com/likehua/p/2074459.html
Copyright © 2011-2022 走看看