[英]Oracle Database BLOB to InputStream in Java?
I made a Java function that takes an InputStream
as an input. 我创建了一个Java函数,它将InputStream
作为输入。 I have a oracle.sql.BLOB
instance to pass to that function. 我有一个oracle.sql.BLOB
实例传递给该函数。 How can I convert it to a InputStream
? 如何将其转换为InputStream
?
Do I need to re-write my function using a BLOB parameter, instead? 我是否需要使用BLOB参数重新编写函数?
您还没有真正说过如何从数据库中获取数据,但您可以使用ResultSet.getBinaryStream()
来获取InputStream
,或者调用getBlob()
来获取Blob
,然后使用Blob
上的getBinaryStream()
来获取一条小溪。
Declare your Java parameter of type oracle.sql.BLOB
as per the "Mapping Datatypes" documentation . 根据“Mapping Datatypes”文档声明类型为oracle.sql.BLOB
Java参数。 Then, you call getBinaryStream()
on that BLOB
object to obtain your InputStream
. 然后,在该BLOB
对象上调用getBinaryStream()
以获取InputStream
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.