我以前也碰到过这个问题.不过是在weblogic下面.始终报classcast错误,我所查的资料显示是说weblogic提供的driver包的问题.不知道你的tomcat的问题是不是一样.

解决方案 »

  1.   

    我在网上查了一整天,说是tomcat连接池取得的不是真正的connection,但他们也没说具体的解决方法,我总不能为了写clob,而专门开一个connection,不知道tomcat的连接池怎么更换,据说是可以的。
      

  2.   

    以下是我的,没有问题tomcat4.0x  //大字段上传
      public void blobUpload(DBAccess dba,FormFile file) throws ObjectException{
        try{
          InputStream stream = file.getInputStream();
          ResultSet rs=null;      if(file.getFileSize()>0){                         //有内容
            byte[] bytes=file.getFileData();
            dba.prepareStatement(SQL_INSERT_BLOB_UPLOAD);
            if(strInsertReturnValue!=null){
              dba.setString(1,strInsertReturnValue);
              rs=dba.executeQuery();
              if(rs.next()){                                //有返回结果
                oracle.sql.BLOB blob=((oracle.jdbc.OracleResultSet)rs).getBLOB("M_FILE");
                OutputStream outStream = blob.getBinaryOutputStream();
                outStream.write(bytes);                     //写入大字段
                outStream.flush();
              }
            }else{
              throw new ObjectException("上传大字段时没有取得m_id的值!");
            }
          }
        }catch(Exception ex){
          ex.printStackTrace();
          throw new ObjectException(ex.getMessage());
        }
      }