写过jdbc操作BLOB和VB操作LONG RAW,却没试过用jdbc操作long raw类型,但我想用resultSet.getBinaryStream()获取Stream然后送到一个file类型应该没有太大的问题。

解决方案 »

  1.   

    long raw ??
      long ??long是按照ascii形式存的
      

  2.   

    long raw ??
      long ??long是按照ascii形式存的
      

  3.   

    这是客户端程序的事,与oracle无关
      

  4.   

    我随意试了一下,用getBytes()能返回long raw中的内容:
    import java.sql.*;
    import java.io.*;
    import connections.*;public class Class4  {
      public static void main(String[] args) {
        Connection conn;
        Statement stmt;
        ResultSet rs;
        String sql;
        byte[] sample;
        
        sql = "Select * from ts";
        try {
          conn = ConnectionFactory.getConnection();
          stmt = conn.createStatement();
          rs = stmt.executeQuery(sql);
          if (rs.next()) {
            System.out.println("Output:");
            sample = rs.getBytes("sample");
            System.out.println((sample.length));
          }
        } catch (Exception e) {
          e.printStackTrace();
        }/* finally {
          if (rs!=null) { ConnectionFactory.close(rs); }
          ConnectionFactory.close(stmt);
          ConnectionFactory.close(conn);
        }*/
      }
    }//connections.ConnectionFactory是我自己写的一个类,用来建立jdbc:thin的connection
      

  5.   

    我随意试了一下,用getBytes()能返回long raw中的内容:
    import java.sql.*;
    import java.io.*;
    import connections.*;public class Class4  {
      public static void main(String[] args) {
        Connection conn;
        Statement stmt;
        ResultSet rs;
        String sql;
        byte[] sample;
        
        sql = "Select * from ts";
        try {
          conn = ConnectionFactory.getConnection();
          stmt = conn.createStatement();
          rs = stmt.executeQuery(sql);
          if (rs.next()) {
            System.out.println("Output:");
            sample = rs.getBytes("sample");
            System.out.println((sample.length));
          }
        } catch (Exception e) {
          e.printStackTrace();
        }/* finally {
          if (rs!=null) { ConnectionFactory.close(rs); }
          ConnectionFactory.close(stmt);
          ConnectionFactory.close(conn);
        }*/
      }
    }//connections.ConnectionFactory是我自己写的一个类,用来建立jdbc:thin的connection
      

  6.   

    我试了以后虽然从库中取出了数据但都是些怪字符,放入word里也是一样的怪字符。如何取出其正常的文本内容.
      

  7.   

    应先用函数取出该行LONG数据的长度,再取出数据。
      

  8.   

    Statement stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery("select wordfield from wordTable");
     sample = rs.getBytes("wordfield");  
      System.out.println((sample.length));
      for (int i = 0; i < sample.length; i++) {
       System.out.println(sample[i]);
      }
    输出得到的是怪字符
      

  9.   

    取出数据后,放入ole,通过ole ,用word打开就是了。用别的软件打开当然是乱麻了,他们怎么认识word的格式呢/
      

  10.   

    这个问题是不是与在SQL server 中
    根据类型为text的字段中的内容(即图片文件的地址)打开响应图片或监控其大小的问题相似呢?
      

  11.   

    我想不是的,word内容是直接放入字段内的,不是在字段内存入word文件的路径