Search code examples
javaoracle11gmulemule-studioanypoint-studio

byte array to blob data type in mule using ojdbc8 jar


I am trying to read an image/pdf from file connector and store this in oracle database having column with BLOB data type. This is working when I am using ojdbc6.jar. Its not working with ojdbc8.jar.

after collecting file I added file to byte array transformer and then database insert was working using ojdbc6.

Can you provide any suggestions for this?

The code I am able to run using ojdbc6 is

<flow name="blob-testFlow">
    <file:inbound-endpoint path="C:\Users\xyxyz\Desktop\filetoblobsdkj" responseTimeout="10000" doc:name="File"/>
    <file:file-to-byte-array-transformer doc:name="File to Byte Array"/>
    <db:insert config-ref="Oracle_Configuration" doc:name="Database">
        <db:parameterized-query><![CDATA[INSERT INTO filetoblob(id,data)
        VALUES(11,#[payload])]]></db:parameterized-query>
        </db:insert>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    </flow>

Solution

  • I found a simple solution after struggle. I just have to modify insert query from

    INSERT INTO filetoblob(id,data)
    VALUES(11,#[payload])
    

    to

    INSERT INTO filetoblob
    VALUES(11,#[payload])