oracle jpg图片存储4k限制 最近做网站遇到一个问题,就是把JPG格式图片存储到ORACLE9I时,发现图片不能超过4K,请各位帮忙看下有没有好的解决办法. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不可能,oracle没有这个限制,我们数据库里存的图片每张都大于100K 我使用FormFile来实现JPG图片上传的,jsp文件代码:<html:form action="/insert" enctype="multipart/form-data"> file:<input type="file" name="file"/> name:<input type="text" name="name"/> <input type="submit"/> </html:form> 存入ORACLE代码:public void insert()throws Exception{ Connection con= Oracle.getConnection("ORACLE_JNDI"); String sql="insert into test values (?,?)"; PreparedStatement pStmt=null; try{ pStmt=con.prepareStatement(sql); con.setAutoCommit(false); pStmt.setString(1,name); pStmt.setBinaryStream(2,file.getInputStream(),file.getFileSize()); // int j=pStmt.executeUpdate(); pStmt.executeUpdate(); con.commit(); } catch(Exception ex) { try{ con.rollback(); }catch(SQLException sqlex){ sqlex.printStackTrace(System.out); } throw ex; }finally{ try{ pStmt.close(); con.close(); }catch(Exception e){e.printStackTrace();} } } 另外我用的是websphere服务器里配置的ORACLE数据源 oracle10G一个用户指向了两个表空间。 如此sql语句如何写呢? oracle过程错误 查询包括多个Blob字段,导出Excel,请教一下,特急谢谢 求教一个sql 优化 请教触发器问题 如何在sql语句中直接调用一个 procedure?谢谢 Windows2000Server上安装Oracle8.1.6不成功,求助? 除了用游标,还有什么办法??你也会遇到...讨论一下 有没有oracle方面的书籍啊 求助 对一张有6000万数据的表字段建索引,需要注意什么?
jsp文件代码:
<html:form action="/insert" enctype="multipart/form-data">
file:<input type="file" name="file"/>
name:<input type="text" name="name"/>
<input type="submit"/>
</html:form> 存入ORACLE代码:
public void insert()throws Exception{
Connection con= Oracle.getConnection("ORACLE_JNDI");
String sql="insert into test values (?,?)";
PreparedStatement pStmt=null;
try{
pStmt=con.prepareStatement(sql);
con.setAutoCommit(false);
pStmt.setString(1,name);
pStmt.setBinaryStream(2,file.getInputStream(),file.getFileSize());
// int j=pStmt.executeUpdate();
pStmt.executeUpdate();
con.commit();
}
catch(Exception ex)
{
try{
con.rollback();
}catch(SQLException sqlex){
sqlex.printStackTrace(System.out);
}
throw ex;
}finally{
try{
pStmt.close();
con.close();
}catch(Exception e){e.printStackTrace();}
} }