Oracle Database BLOB to InputStream in Java?
22,666
Solution 1
Declare your Java parameter of type oracle.sql.BLOB
as per the "Mapping Datatypes" documentation. Then, you call getBinaryStream()
on that BLOB
object to obtain your InputStream
.
Solution 2
You haven't really said how you're fetching data from the database, but you can use ResultSet.getBinaryStream()
to get an InputStream
, or call getBlob()
to get a Blob
, and then getBinaryStream()
on the Blob
to get a stream.
Comments
-
Data-Base over 3 years
I made a Java function that takes an
InputStream
as an input. I have aoracle.sql.BLOB
instance to pass to that function. How can I convert it to aInputStream
?Do I need to re-write my function using a BLOB parameter, instead?