AEM 6.5 inserting PDF document in a table's Blob column | Community
Skip to main content
New Participant
January 4, 2022
Solved

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

  • January 4, 2022
  • 1 reply
  • 869 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by workflowuser

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

1 reply

workflowuserAccepted solution
Employee
January 4, 2022

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

New Participant
January 4, 2022

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

~Leena