You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Vrunda Joshi <vr...@gmail.com> on 2007/01/30 17:32:20 UTC

[Commons]Downloading file from database(Urgent)

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

Re: [Commons]Downloading file from database(Urgent)

Posted by Vrunda Joshi <vr...@gmail.com>.
Sorry for the late reply.I was bit bz in the things,since everything was
working :) Thanks a lot Paul, your information was really helpful. I really
appreciate it.I am using Mysql5.

I have been developing everything on my laptop which is a xp. and now I want
to put everyting on my hosting service,linux. Do I need to make any changes
there? Database is same (MySql) at both place.

thanks a lot,

Vrunda


On 1/30/07, Paul J DeCoursey <pa...@decoursey.net> wrote:
>
> 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 <pa...@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
>
>

Re: [Commons]Downloading file from database(Urgent)

Posted by Paul J DeCoursey <pa...@decoursey.net>.
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 <pa...@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


Re: [Commons]Downloading file from database(Urgent)

Posted by Vrunda Joshi <vr...@gmail.com>.
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 <pa...@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
>
>

Re: [Commons]Downloading file from database(Urgent)

Posted by Paul J DeCoursey <pa...@decoursey.net>.
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