Print the following exception stack:
java.io.IOException: ORA-22990: LOB locators can not be extended transaction
at oracle.jdbc.driver.DatabaseError.SQLToIOException (DatabaseError.java: 764)
at oracle.jdbc.driver.OracleBlobOutputStream.flushBuffer (OracleBlobOutputStream.java: 296)
at oracle.jdbc.driver.OracleBlobOutputStream.close (OracleBlobOutputStream.java: 261)
at com.paradise.jdbc.WriteBlob.main (WriteBlob.java: 82)
This is because the source code for the out stream object caused by the closed position.
Oracle for "ORA-22990: LOB locators can not be extended transaction" exception explained as follows:
ORA-22990 LOB locators cannot span transactions
Cause A LOB locator selected in one transaction
cannot be used in a different transaction.
Action Re-select the LOB locator and retry the operation.
That is a LOB locator can not be used for different matters, in the above source code,
out object is obtained from the blob object is estimated with the LOB locator stream object out of a relationship,
So out stream object in the transaction should close before the end of the action is invoked, that commit () method executes before out.close ();
Because there may be implementation conn.commit (), this out stream object is automatically released,
So conn.commit (); then perform out.close (); will appear above the exception.
Therefore, the finally block above the out.close () moved to conn.commit () before the execution can be.