简体   繁体   中英

Oracle Database BLOB to InputStream in Java?

I made a Java function that takes an InputStream as an input. I have a oracle.sql.BLOB instance to pass to that function. How can I convert it to a InputStream ?

Do I need to re-write my function using a BLOB parameter, instead?

您还没有真正说过如何从数据库中获取数据,但您可以使用ResultSet.getBinaryStream()来获取InputStream ,或者调用getBlob()来获取Blob ,然后使用Blob上的getBinaryStream()来获取一条小溪。

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM