I have the scenario where I need to stream from DB the content of the file directly to the client browser.
So I use plain jdbc rs.getBlob()
then blob.getBinaryStream();
later writing into an http outputstream.
What I noticed (a very good thing ) is that once I have the inputstream via the blob, the db connection is retuned to the the datasource pool. (weblogic)
Now i ask you , my observation is correct ? cause I had the fear that for downloads that will take long time the db connection will stay to the request in order to be able to stream the file.
Apparently once streaming started the DB connection is not used anymore.
will mockup here some code for better understanding
@Trasactional
public void InputStream getIsFromBlob(....){
....
is = blob.getBinaryStream();
...
return is;
}
Later this method is used in a servlet let's say and write the contect of is in the http outputstream
Thanks