This content has been marked as final. Show 2 replies
This is a little more tricky than it looks like. The problem is you can't pass a variable of type document because the jdbc service doesn't really know what a type "document" is. If you put it in a binary object it doesn't work for some reason.
I'm investigation why.
As a workaround you can use the script operation (under Foundation) and use the following script which would add it to your database:
InitialContext _ic = new InitialContext();
ds = _ic.lookup("java:/IDP_DS");
Connection conn = null;
PreparedStatement stmt = null;
conn = ds.getConnection();
String strStmt = "Insert into temp.test Values (9,?)";
stmt = conn.prepareStatement(strStmt);
//Get the document from the document variable
Document myDoc = patExecContext.getProcessDataDocumentValue("/process_data/@pdfdoc");
InputStream inputStream = myDoc.getInputStream();
//Get the size of the InputStream object
int size = inputStream.available();
//Create and populate a byte array
byte data = new byte[size];
ByteArrayInputStream _in = new ByteArrayInputStream(data);
stmt.setBinaryStream(1, _in, _in.available());
Thanks Jasmin for your advice. The workaround is working fine.
Btw, where can we find documentation about patExecContext for LiveCycle ES?