大家好,
我的oracle数据库中的一个表中有一个字段是BLOB类型的,
当我用VC+ado访问这个表时,m_pRecordset->Open会出错,
而把这个字段从表中去掉之后就没有问题了,这是什么原因呢?该怎么解决?
各位请帮帮忙,谢谢

解决方案 »

  1.   

    应该是 blob  不能直接打开的.
    因为blob 存储的可能是 图片 或者是 文件
    你需要写一个过程来读取这个字段
      

  2.   

    public static StringBuffer getClobToString(Clob clob) throws SQLException, IOException {
        //返回结果
    StringBuffer sResult = null;
        if (clob != null){
          Reader reader = clob.getCharacterStream();
          StringBuffer sbTemp = new StringBuffer();
          BufferedReader buffReader = new BufferedReader(reader);
          char[] cbuftemp = new char[1000];
          while ((buffReader.read(cbuftemp)) != -1) { 
            sbTemp.append(cbuftemp.clone());
          }
          sResult = sbTemp;
        }
        return sResult;
      }
     public static StringBuffer getClobToString(ResultSet rs,int clobidx) throws SQLException
         {        
            oracle.sql.CLOB clobField = ((OracleResultSet)rs).getCLOB(clobidx);
            long clen=clobField.length();
            char clobArray[] = new char[(int)clen];
            int readednum= clobField.getChars(1,(int)clen,clobArray);
            StringBuffer sb = new StringBuffer();
            sb.append(clobArray);        
            return sb;
         }
      

  3.   

    连接字符串不要用ms,要用oracle的