Does anyone know if it is possible to write to a Clob-based XMLTYPE column using standard JDBC 3.0 APIs? We'd like to avoid using Oracle-specific APIs (and the Spring LobHandler work-around) so that monitoring software (such as JAMon which wraps connections in a java.lang.reflect.Proxy) can be used.
The Oracle 10g JDBC driver officially supports JDBC 3.0 "completely", but this has been my progress so far:
1. PreparedStatement.setString - throws ORA-01461 if xml > 4KB
2. PreparedStatement.setAsciiStream - throws ORA-01461 if xml > 4KB
3. Using "SetBigStringTryClob" connection property and PreparedStatement.setString - works if writing to a CLOB, but if writing to an XMLTYPE then throws ORA-01461 if xml > 4KB
4. Using "SetBigStringTryClob" and PreparedStatement.setObject, with type set to java.sql.Types.CLOB or java.sql.Types.VARCHAR - throws "java.lang.String" expected or ORA-00932.Code:INSERT INTO MY_TABLE(ID,XML) VALUES (?,XMLTYPE(?))
5. Using oracle.sql.CLOB.createTemporary and PreparedStatement.setObject works fine but uses Oracle-specific APIs that require direct access to the underlying OracleConnection!