Back Forum Reply New

Insert BLOB into XA datasource with JDBC

My application needs to read in file content and then insert into a BLOB column of an oracle database. Since I need to update several databases in one transaction, I used XA data source driver oracle.jdbc.xa.client.OracleXADataSource.

My code to insert the BLOB column quot;BODYquot; is like:   LobHandler lobHandler = new OracleLobHandler();    jdbcTemplate.execute( quot;INSERT INTO ATTACHMENT (ID, BODY) VALUES (?, ?)quot;, new AbstractLobCreatingPreparedStatementCallback( lobHandler )    {       @Override        protected void setValues( PreparedStatement ps, LobCreator lobCreator ) throws SQLException        {            ps.setString( 1, attachmentSfId );            lobCreator.setBlobAsBinaryStream( ps, 2, fin, (int) f.length() );        }    } );

This code doesn't work when I use the XA data source driver, but it works when I use oracle.jdbc.driver.OracleDriver. Do any of you know how could I insert into a BLOB column with XA data source? Thanks a lot!!
¥
Back Forum Reply New