Expand my Community achievements bar.

SOLVED

AEM 6.5 inserting PDF document in a table's Blob column

Avatar

Level 5

Hi,

I have a custom bundle/code that converts the submitted XML data and XDP template into a PDF document, when an user fills in the form and submits it. The com.adobe.aemfd.docmanager.Document is used to generate this PDF file. 

The code contains Oracle prepared statement that stores the form's name and xdp name. This is working fine. 

I like to add/insert the PDF file in the table. The table is altered to include the Blob column.

The code ps.setBlob(3, generatedPDF); is generating the following error:

The method setBlob(int, Blob) in the type PreparedStatement is not applicable for the arguments (int, Document)

How to cast the document argument to type Blob?

Thanks,

Leena

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

ps.setBlob(3,generatedPDF.getInputStream());

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

ps.setBlob(3,generatedPDF.getInputStream());

Avatar

Level 5

Thank you for the quick response. I think this resolved the type casting problem. 

~Leena