Image retrieval from database
How can i display an image item (BLOB) of oracle database on an HTML page using JAVA servlets?
Put an IMG tag into the HTML page.
Let the URL be your servlet. Do not forget to set the content type.
Similar Messages
-
Where are APEX images retrieved from in an n-tiered environmen?
Oracle XE DB 11gR2
Oracle APEX 4.1.1
Glassfish 3.1.2
Red Hat Linux 5.8
===========
I notice when using Glassfish as part of my APEX environment I am required to copy the images to an /i directory on the Glassfish server under the Glassfish domain.
The question arises --> When APEX needs to render an image, is the image retrieved from the database/database server or from the Glassfish web server?
Thank you.>
Please update your forum profile with a real handle instead of "user601798".
Oracle XE DB 11gR2
Oracle APEX 4.1.1
Glassfish 3.1.2
Red Hat Linux 5.8
===========
I notice when using Glassfish as part of my APEX environment I am required to copy the images to an /i directory on the Glassfish server under the Glassfish domain.
The question arises --> When APEX needs to render an image, is the image retrieved from the database/database server or from the Glassfish web server?The answer (as usual) is "It depends".
If you're using Glassfish and the APEX Listener (or OHS) then images referenced using <tt>/i/</tt> / <tt>#IMAGE_PREFIX#</tt> are stored on and retrieved from the web server file system. If using EPG then they're stored on and retrieved from the database using the XMLDB repository.
If the image is referenced using <tt>#WORKSPACE_IMAGES#</tt>, <tt>#APP_IMAGES#</tt>, or declarative BLOBs then they're stored on and retrieved from the database. -
Jasper report on HTML when one image loaded from database and for the other
How to generate jasper report on HTML when one image loaded from database and for the other we give a image path
My code
ByteArrayOutputStream baos = new ByteArrayOutputStream();
exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, strImageInputDirectory);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, strImageOutputPath == null ? "." : strImageOutputPath);
exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.TRUE);
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporter.exportReport();
byte[] bdata = ((ByteArrayOutputStream) baos).toByteArray();
Can any one help pls
Message was edited by:
ameet.auhey sorry for posting it in this forum.
but do u have sample code for making it work.. since i am able to do it on PDF format(image from Database and another stored in the webserver) using
byte image[] =(byte[]) outData.get("image");
ByteArrayInputStream img = new ByteArrayInputStream(image);
hmimg.put("P_PARAMV3", img);
print = JasperFillManager.fillReport(reportFileName, hmimg, jrxmlds);
bdata= JasperExportManager.exportReportToPdf(print); -
Getting image path from database( Remote server) & display in jsp page
hai frnds,
i have one doudt regarding in my web application Development
. I want to Getting image path from database( **Remote server**) & display in jsp page here iam forwarding my control through Servlets
how this will passiable
Thanks in Advance
SonyKamesh
[email protected]hai
I think ur doubt will be...
1) Getting a Image From Remote Server( & U stored a only path name in Data Base)
2) Image r stroed in saparate Drive( Not in Webroot-- where u Created domine )
Please Any Help Will be Appriciated
[email protected]
Edited by: Sonykamesha on Dec 18, 2007 11:02 PM -
Re: [Re: Keys retrieval from database]
Hi Joseph,
Thank you for your reply.I am using ODBC to connect Forte application with the database.And I went through the document, and tried all the possible ways, I could't succed in retrieval of whole data.I tried the sql execute procedure also.I will the error message
after sometime.How does it related with escript?please clarify.
Thank you,
J.Babu
[email protected] wrote:
Hello Jendran,
take a look at your 'Online-Help'. Search for 'DBDataType' (DBColumnDesc) and
'GetDatabaseDesc' and look if your question is answered.
See the 'Accessing Database Guide' Page 236 for a complete description of the
call ('sql execute procedure' not 'sql execute Immediate procedure').
Look wether you connect via ODBC or Direct to the database in your
DBResourceMgr (Perhaps you have to look how this is specified in your
environment in 'econsole'). If you have any more problems please copy
the error-message in your email, to see what forte says to this error.
Hope this helps
Joseph Mirwald
At 04:30 18.06.98, you wrote:
Hi guys,
Have any one used the method GetDatabaseDesc() of DbSession classto retrieve columns, primary keys and Foreign keys of a database? I
couldn't retrieve any information except columns of MsSql server
database.If possible give some information.
I couldn't execute stored procedure from Forte, what could be theproblem? we tried with sql execute Immediate procedure.
Thank you in advance,
J.Babu
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Babu,
Note that though you will be able to get column information on
most of the
databases, some databases do not maintain or provide access to
key
information. For these databases, specifying DB_IN_KEYINFO and
DB_IN_FOREIGNKEYINFO has no effect. Oracle, Ingres, and Informix
do support key information. Check vendor documentation for
other databases
on specific platforms.
As rightly mentioned by Joseph Mirwald, you might want to email
a copy
of the error message that you get.
Good luck!
Ajith Kallambella M.
Forte Systems Engineer,
Internationational Business Corporation.
From: [email protected][SMTP:[email protected]]
Reply To: [email protected]
Sent: Thursday, June 18, 1998 12:30 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: Keys retrieval from database
Hi guys,
Have any one used the method GetDatabaseDesc() of DbSession
class to retrieve columns, primary keys and Foreign keys of a
database? I couldn't retrieve any information except columns of MsSql
server database.If possible give some information.
I couldn't execute stored procedure from Forte, what could be
the problem? we tried with sql execute Immediate procedure.
Thank you in advance,
J.Babu
Get free e-mail and a permanent address at
http://www.netaddress.com/?N=1
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
Data Could not be retrieved from database...
Hi All,
I have a problem on Excel 2007 while refreshing (for pivot table) data from SQL Server view:
"Data could not be retrieved from database. Check the database server or contact your database administrator. Make sure that external database is availiable, and then try the operation again"
Excel file is distributed on about 20 workstations in network with the same Excel version, and problem occurs only on one station. I have checked credentials and connection between workstation and server and it seems to be ok.
Any ideas?it is problem, because sql server is not member of domain... so I'm using sql aunthentication.
strange thing is that from any other workstations (aldo in domain) it works fine when providing SQL user. I'm supposing that it is problem with some excel settings -
I had stored a png image into a database, when i retrieve it and display it the background is no longer transparent?
I am loading the blob returned from the select statement by using the "loadBytes" method of the "UILoader" class.
Thanx in advance
gv1979If you want to stick with adjusting the scale you can do this two ways. Edit the value graph or edit the speed graph.
The problem is that a camera move, a zoom or a dolly in, is not linear and scale is. This means the graphs are not a good representation of what you'll see visually. This makes them hard to use. At a constant rate for scale the appearance is that the increase in size slows down to closer you get to the final value. In other words, as you scale an object up at a constant rate, the visual appearance is a gradual slowing.
A speed graph edited to look like this gives the appearance of a constant rate scale of the layer when you expect an acceleration at the end. There's just not enough granularity in the graph editor or enough control to predictably achieve the results you want.
You'll have better luck editing the value graph to look something like this:
While this looks extreme, you will get closer to achieving the results you want using the value graph. Once again, the amount of control and the resolution of the graph combined with the visual tomfoolery that scaling an object brings with it makes this a difficult way to achieve predictable results.
You select the graph you'll edit by clicking on the second icon from the left.
As I said before, you'll have much better luck getting the look you want if you make the layer 3D and move a camera toward it. -
Problem Populating Image Item From Database
Hi All,
I am using Oracle 9i & Forms 6i on Windows platform & working in client/server model. I created a form in which, I am reading an image file from the file system & then saving it into the database. In the Databse, i created the column as BLOB. But, when I query, this does not retrive the saved image in Image Item. But image is actually saved. When I tried, changing the database column to LONG RAW, it is working. I mean its reading the image in the image item from the database.
Can anyone pls tell me, is there any problem like this, as we can retrive from LONG RAW but not from BLOB, or I am missin something here.
RegardsHi,
I use Forms 6i to save and retrieve image in BLOB column without problems.
Some weeks ago, my column was long raw and I update it without problems. Nothing to do in Forms and juste modifiy query and recompile in Reports. -
Issues with Image rendering from Database
Maestros,
I have an issue here that I working but can hardly find a plausible solution and would like some help from the community. I'll do my best to explain the my issue in detail that way those of you who are savvy in this domain can jump on it right away.
I am in the process of implementing a shopping grid where products are shown as items on the grid. Each grid contains a custom product tag that contains a product image thumbnail, the description and price. All picture images are stored in a postgres sql database as byte arrays. I retrieve and rendered them on the product grid using a servlet that calls my product service.
The problem I am having is that when products are rendered not all the images are rendered even though they are present. One a refresh is done, some of the ones that previously did not render on renders and some that did go missing. I am using jsf and it looks like the application reaches the render response phase before the images are completely retrieved. I am also implement hibernate ehcache to see if that can help solve the problem, to no avail.
Is my approach the right approach? I know some of you would want to ask why I save images in a database and if you really want to know, the reason is because products are loaded dynamically and one product can have as many images as the e-shop manager wants. If please have another way to solve this problem please feel free to let me know. I am sure there is a better way of retrieving those images and render them without any issues and if you have done anything like that before feel free to send me some directions.
Thanks
Edited by: user10444142 on Oct 7, 2010 5:55 AMIntermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first. Networks that have inherent issues can be seen to work differently with different versions of the same software. You might also try moving the Apple TV away from other electrical equipment. -
Playing a video file retrieved from database using JMF
Hello!
I am developing a multimedia application that has to store videos, music, pictures in a database. I did a little searching and found that JMF is a very good solution in playing video/music using Java. I found some examples to play the video/music stored on the hard drive (as separate files), but i have to be able to take the video/music from the database, and feed it to the JMF player. Has anyone some suggestions about how this could be done?
Thanks in advance!
Edited by: radu.miron on May 8, 2008 9:03 AMWell, i think i didn't make myself clear enough :). i know how to retreive the data from the database. The thing is this: let's suppose i have a 700 MB movie stored in the database. One option to play that movie would be to retrieve it from the DB, create a file somewhere on the disk, and put the data retrieved from the database in that file. But this involves that the disk will be overflooded when let's say 100 people watch 100 different movies. Another option (as i see it) would be to gradually take parts of the movie from the database (first 50 MB, then another 50 MB, then another and so on), and feed it to the JMF player. The user will watch the movie, but will not have the whole movie available, just a part of it. As he watches it, the application takes the next chunck of movie data and feeds it to the JMF player. That was the question i intended to ask, if anyone has any idea regarding the second option, and not the part with retrieving from the database, but the part with giving the JMF player video data to play.
The example i found on the web with JMF player is the following:
import javax.swing.*;*
*import javax.media.*;
import java.awt.*;*
*import java.awt.event.*;
import java.net.*;*
*import java.io.*;
public class PlayVideo extends JFrame {
Player player;
Component center;
Component south;
public PlayVideo() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
JButton button = new JButton("Select File");
ActionListener listener =
new ActionListener() {
public void actionPerformed(
ActionEvent event) {
JFileChooser chooser =
new JFileChooser(".");
int status =
chooser.showOpenDialog(PlayVideo.this);
if (status ==
JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
try {
load(file);
} catch (Exception e) {
System.err.println("Try again: " + e);
button.addActionListener(listener);
getContentPane().add(button,
BorderLayout.NORTH);
pack();
show();
public void load(final File file)
throws Exception {
URL url = file.toURL();
final Container contentPane =
getContentPane();
if (player != null) {
player.stop();
player = Manager.createPlayer(url);
ControllerListener listener =
new ControllerAdapter() {
public void realizeComplete(
RealizeCompleteEvent event) {
Component vc =
player.getVisualComponent();
if (vc != null) {
contentPane.add(vc,
BorderLayout.CENTER);
center = vc;
} else {
if (center != null) {
contentPane.remove(center);
contentPane.validate();
Component cpc =
player.getControlPanelComponent();
if (cpc != null) {
contentPane.add(cpc,
BorderLayout.SOUTH);
south = cpc;
} else {
if (south != null) {
contentPane.remove(south);
contentPane.validate();
pack();
setTitle(file.getName());
player.addControllerListener(listener);
player.start();
public static void main(String args[]) {
PlayVideo pv = new PlayVideo();
}but this example plays a video stored on the disk ( player = Manager.createPlayer(url); ), rather than a chunck of data (the whole movie or parts of it) retrieved from the database.
Sorry for the misunderstanding!
Cheers! -
How to cache images retrieved from MDM on Java WebAS
Hello Colleagues,
We have a scenario where we are trying to retrieve image records from the MDM using Java APis. Instead of hitting the DB everytime, is there a way to implement caching? For instance, is it possible to cache the images on the java WebAS and return the path of the images instead of returning the byte stream everytime?
Thanks and Regards,
Nisha
Edited by: Nisha NC on Sep 1, 2009 7:35 AMHi Nisha,
You can use the Class ObjectCache from the Java API.
For more information please refer to:
http://help.sap.com/javadocs/MDM71/current/API/index.html
Hope this helps,
Idan -
I want to display a couple of rows that will sow about 4 images per row. But images need to be rotated every time the page is refreshed, and the images come from links on the database. Any help will be appreciated. Thanks
This might get you started with the basics
Dynamically populating a JavaScript image slideshow
Here's another one using Bootstrap, PHP and MySQLi *improved*.
http://www.phpgang.com/dynamic-image-slider-using-twitter-bootstrap-php-with-mysql_471.htm l
Nancy O. -
Retrieval of image (Blob) from database - doesn't always work in JSP - Why?
In my JSP pages, when an image needs to be retrieved, I direct <img src> to a servlet that handles image processing.
As an example, if I have 30 products that need to be shown on 1 webpage, there will be 30, dynamically generated, <img src="go.imageServlet?id=a1"> tags/statements. The servlet, when called, will make a connection to the database, run a query for the image requested (fetched as type Blob), image displays in <img src> area of JSP page, and finally the ResultSet, Statement, and Connection object(s) are closed.
I tested this out, and unfortunately, to my surprise, and disappointment, a few images did not display on the page. Though the images are in the database table. I'm a little lost as to why this problem is occurring.
Can someone please shed some light on this for me?evnafets wrote:
If you request just one image, does that image come back broken, or is it different images that are 'broken' each time?On a page of almost 30 image requests (thumbnail size), it varies, but typically, 1-3 images are 'broken' each time. And they are not always the same images. Very strange.
There may potentially be thread concurrency errors depending upon how you have written your servlet - ie one request for an image interfering with another because they use the same variable.
To make it threadsafe, in your servlet make sure that you only use variables local to the doGet/doPost method, and not any class attributes.In my JSP page that makes the requests for these images, a String array generates the <img src> tags on the page, as a very basic example :
<% for(int i=0; i<products.length; i++) {
%>
<img src="go.imageP?imageNumber=<%=products[[0]%>">
<% }//for %>
Sorry for not posting code snippets from my servlet in my first post of this topic....
Here is my servlet snippet - public class ImageProcessingServlet extends HttpServlet {
public Connection conn = null;
public ResultSet rs = null;
public Statement stmt = null;
public PreparedStatement pstmt = null;
public PrintWriter out = null;
public String siteNameReference = "";
int maxFullSizeImageWidth = 600;
int maxSizeImageWidth = 300;
int maxSizeThumbWidth = 140;
int maxImageFields = 4;
String errorMessage = "";
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
doPost(req,res);
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
try {
HttpSession session = req.getSession();
siteNameReference = req.getParameter("snr");
String process = req.getParameter("process");
if(process == null) process = "";
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/imageDB");
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery("Select "+imageNumber+" from images");
rs.next();
Blob blobImage = rs.getBlob(1);
getImage(blobImage,"thumb",res);
if(rs != null) { rs.close(); }
rs = null;
if(stmt != null) { stmt.close(); }
stmt = null;
if(pstmt != null) { pstmt.close(); }
pstmt = null;
conn.close();
conn = null;
}//try
catch (Exception e) { }
finally {
if (rs != null) {
try { rs.close(); } catch (SQLException e) { ; }
rs = null;
if (stmt != null) {
try { stmt.close(); } catch (SQLException e) { ; }
stmt = null;
if (pstmt != null) {
try { pstmt.close(); } catch (SQLException e) { ; }
pstmt = null;
if (conn != null) {
try { conn.close(); } catch (SQLException e) { ; }
conn = null;
}//finally
}//post
public void getImage(Blob blobImage, String imageType, HttpServletResponse res) {
try {
//imageType will = Super = 600
// = Large = 300
// = Thumb = 150
res.reset();
res.setContentType("image/jpeg");
BufferedInputStream bis = new BufferedInputStream(blobImage.getBinaryStream());
BufferedOutputStream bos = new BufferedOutputStream(res.getOutputStream());
if(imageType.equals("super")) {
byte[] imageBytes = new byte[(int)blobImage.length()]; //picture size
int length;
while((length = bis.read(imageBytes)) > 0) {
bos.write(imageBytes, 0, length);
bos.flush();
res.flushBuffer();
} else
if(imageType.equals("large")) {
resize(bis,bos,maxSizeImageWidth);
bos.flush();
res.flushBuffer();
} else
if(imageType.equals("thumb")) {
resize(bis,bos,maxSizeThumbWidth);
bos.flush();
res.flushBuffer();
}//if
//close streams
bis.close();
bos.close();
}//try
catch(Exception e) {}
}//end
public void resize(BufferedInputStream bis, BufferedOutputStream bos, int maxImageWidth) {
try {
BufferedImage bufimg = ImageIO.read(bis);
//size of image
int img_width = bufimg.getWidth();
int img_height = bufimg.getHeight();
double scale = (double)maxImageWidth/(double)img_width;
Image sized = getScaledInstanceAWT(bufimg, scale, Image.SCALE_SMOOTH);
//convert image to BufferedImage
BufferedImage resized = toBufferedImage(sized, BufferedImage.TYPE_INT_RGB);
ImageIO.write(resized,"jpeg",bos);
}//try
catch(Exception e){}
}//end
Edited by: webnotick on Apr 13, 2010 12:24 PM
--added a method to the code snippet -- -
Image retrieval from the database
Currently running Portal 3.0.6.5.5 on RDBMS 8.1.7, Solaris 2.8.
I have a table that has a blob column containing an image (jpeg's though I don't think this matters). I have written a PL/SQL portlet to display information, from this table. To display the images I am writing the following html tags :
<IMG SRC="PORTAL30.wwa_app_module.file_download?p_block=DEFAULT&p_object=IMAGE&p_source=AAAI9YAAEAAAFSyAAS">
Where IMAGE is the column name and the value in p_source is the rowid. Initially this worked fine, but more now more often then not the page is simply displaying the image area and not the image. The call is working to a certain extent because the image area is the correct size.
What could be causing this problem?
For information I am using IE 5.50.4522.1800, if this problem is browser related.
ThanksCurrently running Portal 3.0.6.5.5 on RDBMS 8.1.7, Solaris 2.8.
I have a table that has a blob column containing an image (jpeg's though I don't think this matters). I have written a PL/SQL portlet to display information, from this table. To display the images I am writing the following html tags :
<IMG SRC="PORTAL30.wwa_app_module.file_download?p_block=DEFAULT&p_object=IMAGE&p_source=AAAI9YAAEAAAFSyAAS">
Where IMAGE is the column name and the value in p_source is the rowid. Initially this worked fine, but more now more often then not the page is simply displaying the image area and not the image. The call is working to a certain extent because the image area is the correct size.
What could be causing this problem?
For information I am using IE 5.50.4522.1800, if this problem is browser related.
Thanks -
Image reclaim from database ,facing problem
I am very much new in Flex development.........
I am facing a problem from quite a few days to reclaim a image from the database with the help of servlet to a flex application . I am using HttpRequest Object not Blaze Ds.
Actually image byte stream is comming back from Servlet to Flex End , but when I want to display it , then it shows the place of the image as black .I think image pixel's are not combining togather ..........Have you any Idea?
I am trying in the following way.......... this is in the result handler method................
private function getPhotoResultHandler(event:ResultEvent):void{
try{
xmldata1=event.result as XML;
mx.control.alert.show(xmldata1.toString); // Here I can see the byte stream in the browser
var byteData : ByteArray;
var dec : Base64Decoder = new Base64Decoder();
dec.decode(xmldata1.toString());
byteData = dec.toByteArray();
imggetPhoto.source=byteData;
catch( ex : Error )
Alert.show( ex.message );Hi,
I use Forms 6i to save and retrieve image in BLOB column without problems.
Some weeks ago, my column was long raw and I update it without problems. Nothing to do in Forms and juste modifiy query and recompile in Reports.
Maybe you are looking for
-
my computer crashed so i have a new itunes and i am trying to put my music from my old phone into itunes, it doesnt transfer only shows up when my phone is plugged in?
-
%ASA-7-710005: TCP request discarded error in Client to Site VPN in CISCO ASA 5510
Hi Friends, I'm trying to built client to site VPN in CISCO ASA 5510 8.4(4) and getting below error while connecting cisco VPN client software. Also, I'm getting below log in ASA. Please help me to reslove. Error in CISCO VPN Client Software: Secure
-
Memory leak in Acrobat X?
I use Acrobat X Standard version 10.0.2 under Windows XP. When working with large documents, I often have problems with the Acrobat program. The first symptom is that icons on the toolbar disappear or become black boxes. Then whole pages of the docum
-
Simple source codes using JAXM Provider
Hi guys, I am new to this technology. I looked around the web for simple codes using JAXM Provider but not luck. I will appreciate your help if someone out there have working example using JAXM service Provider. Thanks in advance...
-
Hi all! Wow - so much trouble for a software upgrade I've upgraded my iPhone 3G (legal one - read: not jail broken or anything ) to 3.1 and now the switch which will enable/disable 3G network is gone ( I just don't get it ). I've tried to do a restor