Okay.  Your point was you don't know how to write a response?  Okay. 
I will let the others know that we were wrong that you wanted to do
this right.

On 9/27/05, Mark Benussi <[EMAIL PROTECTED]> wrote:
> Thanks Murray.
>
> Jack you missed my point, it was nothing to do with the expense of file
> writing etc but with the hit of obtaining a database connection and writing
> the bytes to file (In whatever highly efficient method you recommend)
>
> -----Original Message-----
> From: Murray Collingwood [mailto:[EMAIL PROTECTED]
> Sent: 27 September 2005 22:46
> To: user@struts.apache.org
> Subject: Re: writing images from a database
>
> I went through the process recently - the performance of MySQL handling
> images was
> soo bad I immediately changed all my thinking and put the images in a
> sub-directory in
> my file system.
>
> The code I was using was buffering (32k) and the images were only about 100k
> and still
> I had to wait 8 seconds for them to appear on my browser - simply not
> accepable. The
> same images in the file system appeared near-instantaneously on my browser.
>
> Also, MySQL had a default buffer size limit of 1mb, any file I uploaded
> needed to be
> within this limit.  I know I can modify this, but what do I modify it to?
> Should I make it
> 2mb, 10mb, 100mb, 2gb, 4gb, how big is my upload file going to be?  It was
> all very
> restrictive and badly implemented.  Maybe oracle is better?
>
> Kind regards
> mc
>
>
> On 27 Sep 2005 at 9:47, Dakota Jack wrote:
>
> > You need to put in a bit more buffering, etc. in this code, Mark.  I
> > recommend you read up on how to read and to write to files more
> > efficiently.  Also, due to the nature of how computers work, I would
> > highly recommend you create a multi-threaded application to do this.
> > You will find that your performance will be hugely impacted.
> >
> >
> >
> > On 9/27/05, Mark Benussi <[EMAIL PROTECTED]> wrote:
> > > I've seen this conversation before so I don't think I am saying anything
> > > outlandish here.
> > >
> > > There is a performance overhead from reading a database to present to
> the
> > > JSP page, however you look at it. There is nothing wrong with writing
> the
> > > image once to the file system, and storing a reference to the image on
> the
> > > file system.
> > >
> > > -----Original Message-----
> > > From: Braun, James F [mailto:[EMAIL PROTECTED]
> > > Sent: 27 September 2005 17:24
> > > To: Struts Users Mailing List
> > > Subject: writing images from a database
> > >
> > > Goal: Read a blob image from an Oracle database and render it on an html
> > > page using the struts framework.
> > >
> > > I've never found a good way to do this and I was hoping someone had a
> > > "best practice" suggestion.
> > >
> > > I have no trouble getting the image from the database. However, I wonder
> > > if there isn't a better way to display it rather than writing it to a
> > > physical file and then rendering it. I'm using the <html:img tag to
> > > display the image now.
> > >
> > > All help appreciated.
> > >
> > > J.
> > >
> > > ImputStream pictureStream;
> > > ResultSet rs;
> > >
> > > // create the query and execute it ...
> > >
> > > // get the result
> > > pictureStream = rs.getBinaryStream("picture");
> > >
> > > // I can write it to a physical file
> > > File pictureFile = new File("/temp/picture.jpg");
> > >
> > >         try
> > >         {
> > >           FileOutputStream out = new FileOutputStream(pictureFile);
> > >           int chunk = 0;
> > >           while( (chunk = pictureStream.read()) != -1)
> > >           {
> > >             out.write(chunk);
> > >           }
> > >           out.close();
> > >           out.flush();
> > >         }
> > >         catch(FileNotFoundException ex)
> > >         {
> > >           System.err.println("selectionForm.populate.picturefile: " +
> > > ex.getMessage());
> > >           logger.error("selectionForm.populate.picturefile: " +
> > > ex.getMessage());
> > >         }
> > >         catch(IOException ex)
> > >         {
> > >           System.err.println("selectionForm.populate.picturefile: " +
> > > ex.getMessage());
> > >           logger.error("selectionForm.populate.picturefile: " +
> > > ex.getMessage());
> > >         }
> > >
> > > --
> > > This transmission is intended only for use by the addressee(s) named
> herein
> > > and may contain information that is proprietary, confidential and/or
> legally
> > > privileged. If you are not the intended recipient, you are hereby
> notified
> > > that any disclosure, copying, distribution, or use of the information
> > > contained herein (including any reliance thereon) is STRICTLY
> PROHIBITED. If
> > > you received this transmission in error, please immediately contact the
> > > sender and destroy the material in its entirety, whether in electronic
> or
> > > hard copy format. Thank you.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > "You can lead a horse to water but you cannot make it float on its back."
> > ~Dakota Jack~
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.344 / Virus Database: 267.11.7/112 - Release Date: 26/09/2005
> >
>
>
>
> FOCUS Computing
> Mob: 0415 24 26 24
> [EMAIL PROTECTED]
> http://www.focus-computing.com.au
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.7/112 - Release Date: 26/09/2005
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to