You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Calvin Deiterich <ce...@hacc.edu> on 2006/05/17 20:31:10 UTC

Re: Displaying Photos stored in Oracle in HTML generated by servlet

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" <ce...@hacc.edu>
To: <us...@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


Re: Displaying Photos stored in Oracle in HTML generated by servlet

Posted by Nicholas Sushkin <ns...@openfinance.com>.
On Thursday 18 May 2006 20:52, you wrote: 

> I did find that when I used:
>
> "<img src="/webapp/path/to/servlet.jpg?recId=" + member.getID() + "/>"
>
> The id that was returned had a / after the id which really caused issues.
> (ended up looking like 345556/)
> I changed the "/>" to " />" (a space prior to the /) and the code works
> fine.

You probably want to have something like 

"<img src=\"/webapp/path/to/servlet.jpg?recId=" + member.getID() + "\"/>"

So that it generates

<img src="/webapp/path/to/servlet.jpg?recId=345556"/>

instead of your code, which generates

<img src=/webapp/path/to/servlet.jpg?recId=345556/>

-- 
Nicholas Sushkin, Senior Software Engineer
Open Finance

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


Re: Displaying Photos stored in Oracle in HTML generated by servlet

Posted by CalvinD <ce...@hacc.edu>.
Update.  I go the images to show using two servlets.  One to return the text
items and one to return the image based on the ID in the text.  I used
David's example as a starter.
I did find that when I used:

"img src="/webapp/path/to/servlet.jpg?recId=" + member.getID() + "/>"

The id that was returned had a / after the id which really caused issues.
(ended up looking like 345556/)
I changed the "/>" to " />" (a space prior to the /) and the code works
fine.
I am not sure if this is the best way to get it to work so if anyone has any
ideas, let me know.
Once I get the code cleaned up I will post the appropriate parts.
Calvin

--
View this message in context: http://www.nabble.com/Re%3A-Displaying-Photos-stored-in-Oracle-in-HTML-generated-by-servlet-t1637981.html#a4461548
Sent from the Tomcat - User forum at Nabble.com.


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


Re: Displaying Photos stored in Oracle in HTML generated by servlet

Posted by Calvin Deiterich <ce...@comcast.net>.
David,
You brought up a good point that I didn't even think of.
Since the text is written out to response using a PrintWriter I would
have to use some type of stream output for the images.

I created another servlet just to try and display the images.
I got as far as retrieving them from the database in a DatabaseImage
class and them returning them to a new servlet to display them.

I get an sql error in the DatabaseImage class when I get to the return
statement that says I need to be connected to the server(whatever that
means).

Anyway, thanks for your help.
I will keep the list posted as to my progress.
Calvin


David Smith wrote the following on 5/17/2006 2:56 PM:
> Images are separate resources from the HTML their <img..../> tag is
> spec'd in.  I'd say write your table out with the <img ... /> tag
> specifying a URL to an image serving servlet.  Then put together a
> simple servlet that will handle those requests and stream the
> appropriate data to the client.
> 
> An example: <img src="/webapp/path/to/servlet.jpg?recId=3432234"/>
> 
> The servlet mapped to /path/to/servlet.jpg would use the id to retrieve
> the binary data and just stream it straight to the client via the response.
> 
> --David
> 
> Calvin Deiterich wrote:
>> 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
>>  
>>


Re: Displaying Photos stored in Oracle in HTML generated by servlet

Posted by David Smith <dn...@cornell.edu>.
Images are separate resources from the HTML their <img..../> tag is 
spec'd in.  I'd say write your table out with the <img ... /> tag 
specifying a URL to an image serving servlet.  Then put together a 
simple servlet that will handle those requests and stream the 
appropriate data to the client.

An example: <img src="/webapp/path/to/servlet.jpg?recId=3432234"/>

The servlet mapped to /path/to/servlet.jpg would use the id to retrieve 
the binary data and just stream it straight to the client via the response.

--David

Calvin Deiterich wrote:
> 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" <ce...@hacc.edu>
> To: <us...@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
>
>
>
>   


-- 
David Smith
Network Operations Supervisor
Department of Entomology
Cornell University
2132 Comstock Hall
Ithaca, NY 14853
Phone: (607) 255-9571
Fax: (607) 255-0940


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


Re: Displaying Photos stored in Oracle in HTML generated byservlet

Posted by Rhino <rh...@sympatico.ca>.
Calvin,

Here is the getRow() method which forms the heart of the FetchBlobs class, 
followed by the writeBlobToFile() method, just in case you need it. I'll 
explain these methods after the code:

-----------------------------------------------------------------------------------------------------------------
public void getRow() {

   String METHOD_NAME = "getRow()";

   String tableName = "Blobs";
   if (DEBUG) System.out.println(CLASS_NAME + "." + METHOD_NAME + " - 
tableName
   String getStmt = "select member_name, picture_filename, picture, 
picture_capt

/* Determine path to which blobs should be written. */
   Object[] myResult = Utilities.getCurrentPath("/blobOut");
   boolean pathDecoded = ((Boolean) myResult[0]).booleanValue(); //boolean 
indic
   String DecodedBlobOutPath = null;
   if (pathDecoded) DecodedBlobOutPath = (String) myResult[1];
   else {
      String errorMsg = (String) myResult[1]; //get error message
      System.err.println(errorMsg);
      System.exit(16);
      }

/* Set the WHERE variables. */
   String desiredMemberName = "Rhino";

/* Execute the query. */
   PreparedStatement pstmt01 = null;
   ResultSet rs = null;
   try {
      pstmt01 = conn01.prepareStatement(getStmt);
      pstmt01.setString(1, desiredMemberName);
      rs = pstmt01.executeQuery();
      }
    catch (SQLException sql_excp) {
      if (sql_excp.getSQLState().equals("42S02")) {
         String msg = CLASS_NAME + "." + METHOD_NAME + " - Desired row of 
table
         System.err.println(msg);
         sql_excp.printStackTrace();
         return;
         }
      else {
         String msg = CLASS_NAME + "." + METHOD_NAME + " - Failed to 
retrieve de
         System.err.println(msg);
         sql_excp.printStackTrace();
         return;
         }
      }

/* Prepare to count the number of rows in the result set. */
   int rowCount = 0;

/* Examine the result set, which should be a single row. The values from the 
row
   stored in Class variables. */
   try {
      while (rs.next()) {
         rowCount++;
         memberName = rs.getString("MEMBER_NAME").trim();
         pictureFilename = rs.getString("PICTURE_FILENAME").trim();
         Blob pictureBlob = rs.getBlob("PICTURE");
         writeBlobToFile(pictureBlob, DecodedBlobOutPath, pictureFilename);
         pictureCaption = rs.getString("PICTURE_CAPTION").trim();
         audioFilename = rs.getString("AUDIO_FILENAME").trim();
         Blob audioBlob = rs.getBlob("AUDIO");
         writeBlobToFile(audioBlob, DecodedBlobOutPath, audioFilename);
         audioCaption = rs.getString("AUDIO_CAPTION").trim();
         }
      }
   catch (SQLException sql_excp) {
      String msg = CLASS_NAME + "." + METHOD_NAME + " - Encountered 
SQLException
      System.err.println(msg);
      sql_excp.printStackTrace();
      return;
      }

   if (rowCount != 1) {
      String msg = CLASS_NAME + "." + METHOD_NAME + " - Query failed to 
return e
      System.err.println(msg);
      return;
      }

/* Dispose of the statement and commit. */
   try {
      pstmt01.close();
      conn01.commit();
      conn01.close();
      }
   catch (SQLException sql_excp) {
      String msg = CLASS_NAME + "." + METHOD_NAME + " - Tried to close the 
state
      System.err.println(msg);
      sql_excp.printStackTrace();
      return;
      }
}

public void writeBlobToFile(Blob myBlob, String FilePath, String FileName) {

   String METHOD_NAME = "writeBlobToFile()";

   File binaryFile = new File(FilePath, FileName);

   try {
      FileOutputStream outstream = new FileOutputStream(binaryFile);
      InputStream instream = myBlob.getBinaryStream();

   // int chunk = myBlob.getChunkSize();
      int chunk = 4096;
      byte[] buffer = new byte[chunk];
      int length = -1;

      while ((length = instream.read(buffer)) != -1) {
         outstream.write(buffer, 0, length);
         }

      outstream.flush();
      instream.close();
      outstream.close();
      }
   catch (IOException io_excp) {
      String msg = CLASS_NAME + "." + METHOD_NAME + " - Error: " + io_excp;
      System.err.println(msg);
      io_excp.printStackTrace();
      return;
      }
   catch (SQLException sql_excp) {
      String msg = CLASS_NAME + "." + METHOD_NAME + " - Error: " + sql_excp;
      System.err.println(msg);
      sql_excp.printStackTrace();
      }
}

-----------------------------------------------------------------------------------------------------------------

Here are some notes about the two methods.

The variable DEBUG is just a boolean that I set to true when I want to 
display extra diagnostics and false when I don't want them.

The variable getStmt is the SQL statement that I use to retrive the desired 
row from the database. It uses a combination of string concatenation and 
parameter markers so that it can be flexible about which table it is reading 
and which key it needs.

The method getCurrentPath() is just a method I put in my Utilities class to 
get me information on where it should store the blob after it is retrieved. 
You could simply put the information in a regular String if you like; I'm 
just being a bit fancy here.

The variable desiredMemberName contains the unique key value that I will 
seek when I go after the data in the database. It points to a single row of 
the table.

The query execution should be fairly straightforward for you. I set the one 
and only parameter marker in the getStmt variable to contain the value in 
the desiredMemberName variable, then execute the query.

The query could potentially return any number of rows if I mess up somehow 
and store duplicate records so I set up a counter to count the rows in the 
result set. Then I use the next() method on the result set within the while 
loop to fetch one row at a time. Each row contains two blobs, one of which 
contains a picture and one of which contains a music file. The remaining 
columns contain a memberName (this is the key), a pictureFilename, a 
pictureCaption, an audioFilename, and an audioCaption, all of which are 
Strings. Each column is obtained with the appropriate getXXX method and the 
name of the column.  The two blobs are passed to the writeBlobToFile() 
method.

Then the prepared statement is closed and the connection is committed and 
closed.

The writeBlobToFile() method expects a Blob as input, as well as the path 
and file name where the blob should be written. The path is everything up to 
but not including the file name, e.g. C:\MyDir\.

A variable named binaryFile is created with the path and file name.

Then a FileOutputStream is opened for the binary file and an InputStream is 
retrived for the Blob. The rest of the code in that method simply copies the 
Blob into the file, then closes both streams. By the end of that method, the 
blob is on the hard drive ready for whatever you want to do with it.

I've omitted the code where I get and close the connection since I assume 
that should be obvious for you.

Let me know if any of this isn't clear. It's not the best code ever written 
since it was just a quick prototype but it should be good enough to get you 
going.

--
Rhino



----- Original Message ----- 
From: "Calvin Deiterich" <ce...@comcast.net>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, May 17, 2006 5:44 PM
Subject: Re: Displaying Photos stored in Oracle in HTML generated byservlet


> Rhino,
> I'm on 1.5 also, just too early for 1.6.
> I was really looking to not have to re-invent the wheel with this
> program. I figured that with all the catalog web pages out there,
> someone must be storing images in their database and displaying them
> in HTML.  Guess I was wrong ;-(
> I have the images in the database already so that part is taken care of.
> I would like to see your FetchBlobs.  If you read my earlier post to
> David, I got another servlet started just to handle just the images
> but ran into a (temporary) snag.  I will continue working on it tomorrow.
> Thanks
>
> Calvin
>
>
> Rhino wrote the following on 5/17/2006 4:13 PM:
>> 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
>>
>
>


--------------------------------------------------------------------------------


> ---------------------------------------------------------------------
> 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


Re: Displaying Photos stored in Oracle in HTML generated byservlet

Posted by Calvin Deiterich <ce...@comcast.net>.
Rhino,
I'm on 1.5 also, just too early for 1.6.
I was really looking to not have to re-invent the wheel with this
program. I figured that with all the catalog web pages out there,
someone must be storing images in their database and displaying them
in HTML.  Guess I was wrong ;-(
I have the images in the database already so that part is taken care of.
I would like to see your FetchBlobs.  If you read my earlier post to
David, I got another servlet started just to handle just the images
but ran into a (temporary) snag.  I will continue working on it tomorrow.
Thanks

Calvin


Rhino wrote the following on 5/17/2006 4:13 PM:
> 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
> 


Re: Displaying Photos stored in Oracle in HTML generated byservlet

Posted by Rhino <rh...@sympatico.ca>.
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" <ce...@hacc.edu>
To: <us...@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" <ce...@hacc.edu>
> To: <us...@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