请问你是使用什么平台,是linux还是windows?
你怎么将word文档存在oracle的blob字段中,是否抽出word的内容?

解决方案 »

  1.   

    windows下,
    我要把blob字段值取出来,在网页上面显示。
      

  2.   

    呵呵,我救救你吧!Statement stmt = null;
    ResultSet rset = null;
    java.io.File outfile=null;
    FileOutputStream outfstrm=null;
    InputStream istrm=null;
    oracle.sql.BLOB myblob = null;outfile = new java.io.File("d:/temp/test.doc");
    outfstrm = new FileOutputStream(outfile);
    stmt = connection.createStatement();
    String sql = "SELECT filecontent FROM Placard WHERE placard_id = '11'";
    rset = stmt.executeQuery(sql);if (rset.next()){
        myblob =((OracleResultSet)rset).getBLOB("filecontent");
        istrm = myblob.getBinaryStream();
        int strmdata;
        while((strmdata = istrm.read()) != -1) {
           outfstrm.write(strmdata);
        }
    }
    stmt.execute("commit");
    istrm.close();
    outfstrm.close();
    rset.close();
    stmt.close();呵呵,这样就把文件从数据库中写到服务器上d:/temp/test.doc了,你在通过页面访问就行了,具体参数自己修改一下!GOOD LUCK!
      

  3.   

    哦,少了点东东!
    加上:
    import oracle.sql.*;
    import oracle.jdbc.*;读完文件后自己在加些删除服务器临时文件代码就OK了!
      

  4.   

    谢谢,你的代码很好!
    再问:excel文件如何处理?
      

  5.   

    直接在网页上输出文件内容
    应该可以识别吧
    IE会自动调入word服务
      

  6.   

    呵呵,I服了U,你太不会转弯了吧,你保存为EXCEL文件不就行了!!!!!
      

  7.   

    很简单的:
    setContentType("???/word")即可,WORD的类型是什么,我忘记了,查一下配置文件的MIME部分
      

  8.   

    在输出时设置setContentType("application/msword");