tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <rhi...@sympatico.ca>
Subject Re: Displaying Photos stored in Oracle in HTML generated byservlet
Date Wed, 17 May 2006 20:13:51 GMT
The current version of Java is indeed 1.5. However, the java 1.6 beta is now 
available and a few people are using it - but now me.

I'm still not clear how we can help you.

I understand that you will be getting the pictures from a blob column in the 
database but you say that you don't have a blob column yet and therefore you 
will not have any blob data in the table either. If you're asking how to get 
the photos into the database, I can only guess with respect to Oracle. I've 
never worked with Oracle. Then again, I've found MySQL and DB2 to be very 
similar and I know all the major relational databases have a lot of 
similarities since they are written to the same standards so I'm pretty sure 
that a program that works for DB2 or MySQL will work with minimal changes 
with Oracle.

I've got a little prototype Java program, StoreBlobs, that stores a blob in 
a table column but I just checked and the database is DB2 and it's for a 
rather old version of JDBC (1.22) so I'm using a JDBC-1.22-centric way of 
storing the data, i.e. I'm using setBytes() rather than setBlobs(). I've 
just checked and I don't even have the database any more; that means I don't 
know what the table definition was and therefore I have no way of reliably 
recreating the table so that I can run the code again or try variations of 
the code.

Wait! I just checked the server and have a slightly newer version of 
StoreBlobs that is storing a blob in a MySQL table and using setBlobs() to 
do it. The table still exists. I've just run it and proven that the program 
still works. I also have a program, FetchBlobs, that retrieves the blob from 
the database as well. FetchBlobs writes the blob to the file system so that 
another program can display it on a standard HTML page. You'd have to modify 
that bit of the code; instead of writing the newly fetch Blob to the file 
system, you'd have to somehow make it into an object that the servlet could 
display. I'm really not sure what form that code would have to take.

If either or both of those two prototype programs would help you, let me 
know and I'll post some snippets or even the entire programs. (They're 
small.) As for writing out the blob out in the response, someone else will 
have to help you with that.

--
Rhino



----- Original Message ----- 
From: "Calvin Deiterich" <cedeiter@hacc.edu>
To: <users@tomcat.apache.org>
Sent: Wednesday, May 17, 2006 2:31 PM
Subject: Re: Displaying Photos stored in Oracle in HTML generated byservlet


> Rhino,
> That for getting back to me.
> I am coding with Java 1.5(or whatever they call the latest version). I
> have all the framework done and can create the table without the
> images.
> I would prefer not to have to write the image to the file system since
> there could be many photos being displayed depending on the parameters.
> I have a person class that has one Blob field image_data and five
> String fields(name, location, etc.).
> I need to write that image_data field to the response along with the
> other fields in the servlet so that the image is displayed on the web
> page.
> Thanks
> Calvin
>
>
>
>>>> rhino1@sympatico.ca 5/17/2006 2:11:34 PM >>>
>
> ----- Original Message ----- 
> From: "CalvinD" <cedeiter@hacc.edu>
> To: <users@tomcat.apache.org>
> Sent: Wednesday, May 17, 2006 12:26 PM
> Subject: Displaying Photos stored in Oracle in HTML generated by
> servlet
>
>
>>
>> I am working on a project that queries staff information and photos
> from
>> our
>> oracle database and I need to display this information in a web
> page.
>> I can query and display the textual data but now I need to add the
> image
>> along with the text.
>> If this is not the right form, please direct my to the most
> appropriate.
>> Otherwise, any help will be appreciated.
>
> I'm not quite sure what you want.
>
> Are you asking if it is possible? Are you looking for a program that
> does
> what you want? Are you looking for code fragments that show the gist of
> how
> to do what you want? Are you concerned with how to get the picture out
> of
> the database or how to display it once you've retrieved it or both?
>
> In a nutshell, it sounds like it ought to be pretty straightforward to
> do
> what you want to do. I've obtained blobs from databases before - but it
> was
> a DB2 or MySQL database, not Oracle - it wasn't too hard. Simply
> displaying
> a JPEG, GIF, or PNG from the filesystem within a servlet is easy.
> Fetching a
> blob from a database and then displaying it might be a little harder;
> you
> may have to put the image in the file system first although, now that I
>
> think about it, the ImageIO classes should be able to grab the photo
> without
> first having to write it to the file system.
>
> Of course, I'm assuming that your program will be written in a recent
> version of Java that support ImageIO.
>
> --
> Rhino
>
>
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.392 / Virus Database: 268.6.0/341 - Release Date:
> 16/05/2006
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.392 / Virus Database: 268.6.0/341 - Release Date: 16/05/2006
>
> 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.6.0/341 - Release Date: 16/05/2006


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message