最近做网站遇到一个问题,就是把JPG格式图片存储到ORACLE9I时,发现图片不能超过4K,请各位帮忙看下有没有好的解决办法.

解决方案 »

  1.   

    不可能,oracle没有这个限制,我们数据库里存的图片每张都大于100K
      

  2.   

    我使用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();}
          }  }
      

  3.   

    另外我用的是websphere服务器里配置的ORACLE数据源