stmt = conn.getPreparedStmt(strSql,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE);

解决方案 »

  1.   

    我只接用的是update 这不行吗?why ?
      

  2.   

    sql = "update table1 set content = ? where obj_id = 1";
              ps=con.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE ,ResultSet.CONCUR_UPDATABLE );
              ps.setCharacterStream(1 ,fileReader,100000) ;//
              ps.executeUpdate() ;我的是sqlserver . 这样是完全可以的...
      

  3.   

    我的是sqlserver里的ntext字段...
    具体到你的oracle 的blob字段.你自己多试验吧...
      

  4.   

    我的情况与你的差不多,我是存图片,大于4000byte的东西就存不进去!方法基本相同!
      

  5.   

    怀疑是jdbc的问题,可能用流不行,看看下面的代码是否有帮助/**
      *从数据库获得BLOB字段句炳
      */
      private OutputStream getOutputStream(Connection cn,long ID) throws Exception{
        PreparedStatement st = null;
        OutputStream out = null;
        ResultSet rest = null;
        try{
          String sql = "select content from imagelib where id="+ID;
          st = cn.prepareStatement(sql);
          rest = st.executeQuery();
          if(rest.next()){
            Blob blob = rest.getBlob(1); //获得 blob 对象句柄
            OutputStream blobOs = ((oracle.sql.BLOB)blob).getBinaryOutputStream();
            return blobOs;
          }
          else return null;
        }catch(Exception e){throw e;}
        finally{
          try{
            if(st!=null){
              st.close();
              st = null;
            }
          }catch(Exception e){e.printStackTrace(System.out);}
        }
      }/**
      *图片内容入库
      */
      private void saveContent(Connection cn,Picture picture) throws Exception{
        try{
          OutputStream blobOs = getOutputStream(cn,picture.ID);
          blobOs.write(picture.content);  //内容写入blob,这里picture.content是一个byte[]
          blobOs.close();
        }catch(Exception e){throw e;}
      }