Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying an Oracle BLOB image.

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I believe I have successfully created a "serialized" record e.g. empRecord.class
It holds the data retrieved from an Oracle table.
However I have this problem of trying to get at the BLOB field in empRecord.class from the Applet.
Getting at "serialized" text or numeric fields seem to be quite easy in comparison !
Also I hope I am using the right terminology when I say "serialized" e.g.

I think I know how to connect to the database , create input/output streams and get at an image, but from the Applet, how exactly do I get at this Oracle BLOB in the serialized record ?
Is it possible to create a "window" (java.awt.window) and display the image in it ?

How does one get the "serialized" image into the window ?
Sometimes I despair with JAVA, after nearly 5 months of coding, I am still floundering. Also this proliferation of terminology and packages and tools is very confusing and unhelpful.
It would be nice to know how many of you out there remembers all the classes and methods and whatnot.
[ October 31, 2002: Message edited by: achana chan ]
 
Michael Zalewski
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't give very specific information. But your problem might be trying to serialize a BLOB. Serialize the byte[] from the BLOB instead. A Blob object is only useful while you are connected to the database, and the database connection probably doesn't travel with whatever the heck it is you are serializing to.
Replace

with
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael.
Thanks for the tip.
If I change BLOB to byte[], I have several errors:
On the server side, neither the text data nor the blob is retrieved from the database .
On the client side, the JAVA console throws these distressing errors :
BaseTunnelClient : content-length is 91
BaseTunnelClient : connecting... JSESSIONID=B0959584F5E504ED7B02454C9A277907
java.io.IOException: Server returned HTTP response code: 500 for URL: http://192.168.1.3/saysit/RemotedemoServer
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.checkCookieHeader(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.developer.Tunnel.client.BaseTunnelClient._invokeMethod(BaseTunnelClient.java:194)
at com.developer.Tunnel.RemotedemoClient.query(RemotedemoClient.java:100)
at com.developer.Tunnel.demoApplet.actionPerformed(demoApplet.java:194)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
com.developer.Tunnel.client.BaseTunnelClient$TunnelException: Server returned HTTP response code: 500 for URL: http://192.168.1.3/saysit/RemotedemoServer
at com.developer.Tunnel.client.BaseTunnelClient._invokeMethod(BaseTunnelClient.java:217)
at com.developer.Tunnel.RemotedemoClient.query(RemotedemoClient.java:100)
at com.developer.Tunnel.demoApplet.actionPerformed(demoApplet.java:194)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Michael,
This is how I set empRecord.class ie serialize it, I snipped the code because it is a long tedious piece of code :
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try read this post: http://www.coderanch.com/t/297456/JDBC/java/Retreiving-image-JDBC
Rene
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic