The Oracle BLOB.createTemporary()
method expects the Connection
parameter to be a oracle.jdbc.OracleConnection
object, but connections from Tomcat are managed by DBCP, so the connection
is wrapped in a DBCP class (org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
).
You either need to unwrap it to get the real Oracle connection object, or stop using the Oracle BLOB
.
Just use the JDBC methods: Blob blob = connection.createBlob()
Update
The JDBC Blob
is an interface. There are no implementing classes in the JDK, so you'll always get a DBMS specific implementation. If needed, you can cast to OracleBlob
, which is also an interface, that provides additional Oracle-specific methods.
Interesting javadoc for OracleBlob:
Generally any new code should avoid the direct use of the class BLOB
. For variable declarations use the interface Blob
or this interface as required. Instead of the static methods BLOB.createTemporary(java.sql.Connection, boolean, int)
and BLOB.empty_lob()
please use Connection.createBlob()
and BLOB.getEmptyBLOB()
respectively.