commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul J DeCoursey <p...@decoursey.net>
Subject Re: [Commons]Downloading file from database(Urgent)
Date Tue, 30 Jan 2007 16:52:03 GMT
Are you able to read the blob?  Which database are you using?  You might 
get a faster response if you emailed the list that supports the database 
you are using. The basic idea is you extract the blob as an InputStream 
and write it all to the OutputStream of the request.  The ResultSet has 
a |*getBlob 
<http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#getBlob%28int%29> 
method to get the Blob and Blobs have *||*getBinaryStream 
<http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Blob.html#getBinaryStream%28%29>*()|

to get the InputStream.  Then it's just a matter of reading from that 
stream and writing all you read to the outputStream for the HttpResponse.

Vrunda Joshi wrote:
> Paul
> thanks for the immediate reply. I would like to display it in a Html 
> page.
> In fact I got to the list, I am just trying to read the file.
> thanks
> Vrunda
>
>
> On 1/30/07, Paul J DeCoursey <paul@decoursey.net> wrote:
>>
>> That really depends on a lot of things and is really out of the scope of
>> this list. It should be easy to build the list of file from the database
>> and send that to the client and have the client request one based on
>> uuid or some other identifier. What kind of client is this?  HTML,
>> Flash, Swing, fax machine?
>>
>> Paul
>>
>> Vrunda Joshi wrote:
>> > Hi,
>> >
>> > I am using FileUpload and uploading files into database in a blob
>> > field.It's
>> > working fine. Now for downloading files, I want to give a list of
>> > files(filenames),and as the user selects one,open that particular file
>> > only.
>> >
>> > Can anybody tell me what do I need to do?
>> >
>> > Thanks in advance
>> >
>> > Vrunda
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message