Hi,
I am creating a global temporary table that is session-specific. I
insert a BLOB into this table, and then select the BLOB from this
table into a ResultSet. The ResultSet sees this BLOB object, and I am
able to get the binary input stream from this blob. However, when I
invoke InputStream.rea d(byte[]) on this input stream, I get the
following exception:
java.io.IOExcep tion: ORA-01410: invalid ROWID
ORA-06512: at "SYS.DBMS_L OB", line 751
ORA-06512: at line 1
at oracle.jdbc.dba ccess.DBError.S QLToIOException (DBError.java:6 25)
at oracle.jdbc.dri ver.OracleBlobI nputStream.need Bytes(OracleBlo bInputStream.ja va:179)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:113)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:91)
...
Just for clarity, here is basically the code I'm using:
CallableStateme nt cstmt2 = db.prepareCall( "commit");
CallableStateme nt cstmt = db.prepareCall( "create global temporary
table temp_table (blobid NUMBER unique, blob_col BLOB) on commit
preserve rows");
cstmt.execute() ;
cstmt.close();
cstmt2.execute( );
CallableStateme nt cstmt1 = db.prepareCall( "insert into temp_table
values (1, empty_blob())") ;
cstmt1.execute( );
cstmt1.close();
cstmt2.execute( );
cstmt2.close();
CallableStateme nt plsqlblock =
db.prepareCall( stringThatFills InEmptyBlobInTe mpTable);
plsqlblock.exec ute();
plsqlblock.clos e();
PreparedStateme nt pstmt1 = db.prepareState ment("select blob_col from
temp_table where blobid = 1");
ResultSet rset = pstmt1.executeQ uery();
BLOB bl;
if (rset.next())
{
System.out.prin tln("success.") ; //<--- This prints out.
bl = ((OracleResultS et)rset).getBLO B(1);
}
pstmt1.close();
InputStream bis = bl.getBinaryStr eam();
int numBytes = 0;
byte[] theBytes = new byte[appropriateLeng th];
numBytes = bis.read(theByt es); ///*******EXCEPTIO N HAPPENS
HERE!!!!
I would also like to mention that when I change temp_table to be just
a regular table, everything works correctly.
What's the problem, and how do I fix it?
Thanks,
Corrine
I am creating a global temporary table that is session-specific. I
insert a BLOB into this table, and then select the BLOB from this
table into a ResultSet. The ResultSet sees this BLOB object, and I am
able to get the binary input stream from this blob. However, when I
invoke InputStream.rea d(byte[]) on this input stream, I get the
following exception:
java.io.IOExcep tion: ORA-01410: invalid ROWID
ORA-06512: at "SYS.DBMS_L OB", line 751
ORA-06512: at line 1
at oracle.jdbc.dba ccess.DBError.S QLToIOException (DBError.java:6 25)
at oracle.jdbc.dri ver.OracleBlobI nputStream.need Bytes(OracleBlo bInputStream.ja va:179)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:113)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:91)
...
Just for clarity, here is basically the code I'm using:
CallableStateme nt cstmt2 = db.prepareCall( "commit");
CallableStateme nt cstmt = db.prepareCall( "create global temporary
table temp_table (blobid NUMBER unique, blob_col BLOB) on commit
preserve rows");
cstmt.execute() ;
cstmt.close();
cstmt2.execute( );
CallableStateme nt cstmt1 = db.prepareCall( "insert into temp_table
values (1, empty_blob())") ;
cstmt1.execute( );
cstmt1.close();
cstmt2.execute( );
cstmt2.close();
CallableStateme nt plsqlblock =
db.prepareCall( stringThatFills InEmptyBlobInTe mpTable);
plsqlblock.exec ute();
plsqlblock.clos e();
PreparedStateme nt pstmt1 = db.prepareState ment("select blob_col from
temp_table where blobid = 1");
ResultSet rset = pstmt1.executeQ uery();
BLOB bl;
if (rset.next())
{
System.out.prin tln("success.") ; //<--- This prints out.
bl = ((OracleResultS et)rset).getBLO B(1);
}
pstmt1.close();
InputStream bis = bl.getBinaryStr eam();
int numBytes = 0;
byte[] theBytes = new byte[appropriateLeng th];
numBytes = bis.read(theByt es); ///*******EXCEPTIO N HAPPENS
HERE!!!!
I would also like to mention that when I change temp_table to be just
a regular table, everything works correctly.
What's the problem, and how do I fix it?
Thanks,
Corrine
Comment