本帖最后由 esunshine 于 2009-12-29 21:59:44 编辑

解决方案 »

  1.   

    关于用java存取oracle的long raw类型数据
    public static void insertRaw() {
    Connection conn=null;
    PreparedStatement stmt=null;
    Statement stat=null;
    String sqlQuery="select name,longraw from test1";
    try {
    conn=getConnection();
    if (conn==null) return;
    conn.setAutoCommit(false);
    stat=conn.createStatement();
    ResultSet rs=stat.executeQuery(sqlQuery);
    while (rs.next()) {
    String name=rs.getString(1);
    byte[] longraw=rs.getBytes(2);
    stmt=conn.prepareStatement("insert into test2 values(?,?)");
    stmt.setString(1,name);
    stmt.setBytes(2,longraw);
    stmt.execute();
    }
    conn.commit();}catch(SQLException e) {
    try {
    conn.rollback();
    }catch(SQLException re){}
    e.printStackTrace();
    }finally {
    try {
    stmt.close();
    conn.close();
    stat.close();
    }catch(SQLException ie){}
    }
    }create table TEST1
    (
    NAME VARCHAR2(20) not null,
    LONGRAW LONG RAW
    )
    test2和test1一样,
    这是个例程,我在oracle 9i上运行正常,你根据你自己的表结构改改吧 
      

  2.   

    这个long raw 值大的话,就出错了。