title: Spring JDBC lob insertion fails: Invalid column type
body: <p>The code:</p>
  
  <pre><code>                jdbcTemplate.update("MERGE INTO app_role_data x USING (select ? name, ? xml FROM dual) d ON (x.app_name = d.name) WHEN MATCHED THEN UPDATE SET x.xml_blob = d.xml WHEN NOT MATCHED THEN INSERT(app_name, xml_blob) VALUES(d.name, d.xml)",
                      new AbstractLobCreatingPreparedStatementCallback(lobHandler) {
                              protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
                                      ps.setString(1, appName);
                                      lobCreator.setClobAsString(ps, 2, xmlBlob);
                              }
                      });
  </code></pre>
  
  <p>lobHandler is an instance of OracleLobHandler that's injected in the context.</p>
  
  <p>The exception:</p>
  
  <pre><code>Caused by: java.sql.SQLException: Invalid column type
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:9231)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8812)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:9534)
      at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:9517)
      at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:351)
      at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
      at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:144)
      at org.springframework.jdbc.core.ArgPreparedStatementSetter.doSetValue(ArgPreparedStatementSetter.java:65)
      at org.springframework.jdbc.core.ArgPreparedStatementSetter.setValues(ArgPreparedStatementSetter.java:46)
      at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:815)
      at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586)
  </code></pre>
  
  <p>This is Spring framework 3.0.5.RELEASE.</p>
  
  <p>Our oracle driver dependency is</p>
  
  <pre><code>      &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc14&lt;/artifactId&gt;
          &lt;version&gt;10.2.0.3.0&lt;/version&gt;
        &lt;/dependency&gt;
  </code></pre>
  
  <p>The table:</p>
  
  <pre><code>SQL&gt; desc app_role_data
   Name                      Null?    Type
   ----------------------------------------- -------- ----------------------------
   APP_NAME                       VARCHAR2(64)
   XML_BLOB                       CLOB
  </code></pre>
  
  <p>I'm not even sure what other information I can add, but I'll be happy to do so if I've left something out.</p>