I have an InputStream that I know is a PDF that I need to use to update a Blob in Oracle. How can I transform this stream into a BufferedOutputStream, or otherwise update the Blob with this stream information?
Note that I am not allowed to wrap an Oracle class in my code due to the restrictions of the code.
What I've tried so far:
I have already tried using this answer: https://stackoverflow.com/a/1574857/2188082 to connect the streams, but the result is a NullPointerError, because the OutputStream is empty.
The current Query I am trying to run:
pstmt = dbConn.prepareStatement("UPDATE "+ qualTable("document")+" set document_blob ="
+" utl_raw.cast_to_raw('"+inStream+"') where document_id = " + documentId);
pstmt.execute();
pstmt.close();
I am aware that utl_raw.cast_to_raw may not be the correct oracle method to call for an inStream read, unfortunately I am not as well-versed in Oracle as I would like to be, so I am unaware of the correct cast I should be using.