取数据库内容做为流赋给 outstream ...
具体参考 文件下载,只是把文件流改成数据库取出的流而已...

解决方案 »

  1.   

    这里是写的一个方法,这样修改能就可以直接下载了呢,
     public void outputBlob(String fn,int id){
            try{
                conn.setAutoCommit(false);
                Statement stmt = conn.createStatement();
                ResultSet rset = stmt.executeQuery("SELECT content FROM uploadinfo where id="+id);
                BLOB blob = null;
                while (rset.next()) {
                    blob = ((OracleResultSet) rset).getBLOB(1);
                    System.out.println(blob.length());
                }            FileOutputStream file_out = new FileOutputStream(new File(fn));
                InputStream blob_in = blob.getBinaryStream();
                int temp;
                while ((temp = blob_in.read()) != -1)
                    file_out.write(temp); //读取数据、写入文件系统            file_out.close();
                blob_in.close();
                conn.commit();            rset.close();
                stmt.close();
                conn.close();        }catch(Exception ex){
            ex.printStackTrace();
            return;
            }
        }
      

  2.   

    你看一下,我在这里的回复,或许有帮助。
    http://community.csdn.net/Expert/topic/3609/3609177.xml?temp=.367016你要修改的是:把BLOB放到ByteArrayOutputStream里。