Tomcat中,操作oracle的clob字段出错!!! 我以前也碰到过这个问题.不过是在weblogic下面.始终报classcast错误,我所查的资料显示是说weblogic提供的driver包的问题.不知道你的tomcat的问题是不是一样. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我在网上查了一整天,说是tomcat连接池取得的不是真正的connection,但他们也没说具体的解决方法,我总不能为了写clob,而专门开一个connection,不知道tomcat的连接池怎么更换,据说是可以的。 以下是我的,没有问题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()); } } 话说~大家DAO层的类是怎么命名的呢? 求帮助,正则截取! struts2 页面显示 属性的属性 问题 多人合作开发项目 ORA-00923: 未找到预期 FROM 关键字 在LINUX下配置Tomcat的问题。 初学hibernate遇到的问题 struts中html:form如何调用javascript 求助:求ITeye论坛账号,或者帮我下载一下 几个关于EJB的概念请教 痛苦!百分求助!为什么JDK1.3.1总得不到列显示名称! 华为题,求答案
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());
}
}