Oracle error inserting BLOB via JDBC
Hello,
I'm getting the following Oracle error when I attempt to close an OutputStream that's populating a BLOB:
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_LOB", line 700
ORA-06512: at line 1
I'm accessing an Oracle 8 DB, and have had EXECUTE granted on the DBMS_LOB package in case the problem lay there ( Made no difference )
The relevant Java pseudo-code snippet is:
...Build and execute PLSQL query to INSERT row with EMPTY_BLOB() column
...COMMIT
...Turn autocommit off
...Select Blob column from row just inserted
then...
ByteArrayInputStream in = new ByteArrayInputStream( serializeAction( action ) ); // Returns a byte[]
BLOB locator = handler.getDeferredActionLocator(); // Returns the inserted BLOB column locator
OutputStream out = locator.getBinaryOutputStream();
int chunk = locator.getChunkSize();
byte[] buffer = new byte[ chunk ];
int length = -1;
while ( ( length = in.read( buffer ) ) != -1 )
{
out.write( buffer, 0, length );
}
in.close();
out.close(); // The Oracle exception is thrown here
proc.commit(); // Issues commit and closes DB connection etc.
Any help, much appreciated.
Please ignore this post - solution found
Turns out that DBMS_LOB access must be granted to a user and not a role. (As was the case.)