The basic gist of the problem is how to take a string payload and convert it to CLOB for an oracle <db:insert ... />
I'll need to write and read CLOB data to and from an oracle database. The typical approach for converting String to CLOB is to do something like db.getConnection().createClob()
and then set the data into this created CLOB. It doesn't appear that within MULE, this is a legitimate option as I won't (or at least non-trivially) have access to the connection object. (perhaps i can do some hacky stuff with creating a new connection and converting in a transformer?)
Looking back through documentation and prior versions, there appears to be an old property of <jdbc:connector .../>
as of V3.5.x that could handle individual rows from the database and provide a custom handler for these rows. This jdbc connector has been deprecated and I expect it will be removed in future versions.
So how does this work? How does mule intend to do this? How do i convert a String to CLOB for a <db:insert .../>
Below is a sample flow that will reproduce ths problem.
<db:oracle-config name="Oracle" host="localhost" port="1521" instance="testIns" user="myUser" password="myPass" doc:name="Oracle Configuration" />
<flow name="databaseInsertFlow">
<file:inbound-endpoint path="C:\test\input" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer doc:name="File to String"/>
<db:insert config-ref="Oracle_Configuration" doc:name="Database">
<!-- create table tblTest (cdata clob) -->
<db:parameterized-query><![CDATA[insert into tblTest (cdata) values (#[payload])]]></db:parameterized-query>
</db:insert>
</flow>
UPDATE: Further review of the problem has shown that the issues lies with using the ojdbc7.jar driver. Reverting to ojdbc6.jar resolved the problem using the above flow.