I tried to display gif image from oracle to jsp but nothing appear

i tried to display image from oracle DB to jsp directly without using file processing , and i used Servlet and jsp , Servlet to get image from DB and jsp to use <img> tag , when i Run Servlet code
the image appaer on Microsoft Photo Editor , and when i run jsp the image dose not appear on jsp page , so please anyone has an idea about this broblem ,send the soluation or any information to my e-mail [email protected] , and I'll thankful about your help.
the Servlet and jsp code are below .
thank for your help
Servlet:
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
public class Servlet extends HttpServlet
public void init(ServletConfig config) throws ServletException
super.init(config);
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
response.setContentType("image/gif");
int id = Integer.parseInt(request.getParameter("no"));
// int id = 2 ; when Run Servlet .
ResultSet rs = null;
Connection Lcon = null;
String stmt = " select Image from ImageTable where lmage_id ="+id;
Statement sm = null;
String data1 ="";
try
Lcon = getConntcion();
sm = Lcon.createStatement();
rs = sm.executeQuery(stmt);
if(rs.next())
InputStream in = rs.getBinaryStream(1);
ServletOutputStream sout = response.getOutputStream();
int c;
while((c=in.read())!= -1)
sout.write(c);
in.close();
sout.flush();
sout.close()
}catch(Exception e)
System.out.println("error in selectValue the error is "+e);
finally
rs .close( );
sm .close( );
Lcon.close( );
public Connection getConntcion()
Connection con = null;
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection(",,,,,,,, DB Info ,username and password ,,,,,,,,,,,");
}catch(Exception e)
System.out.println("error in connection the error is "+e);
return con;
Jsp code :
<%@ page contentType="text/html"%>
<html>
<head
</head>
<title> testing image </title>
<body>
<form>
<img src="servlet/Servlet?no=2">
</form>
</body>
</html>

InputStream in = rs.getBinaryStream(1);
byte[] image= null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[8192];
int bytesRead = 0;
while ((bytesRead = in.read(buffer, 0, 8192)) != -1)
     baos.write(buffer, 0, bytesRead);
image= baos.toByteArray();
in.close();
ServletOutputStream sout = response.getOutputStream();
if (image != null)
       sout.write(image);
       sout.flush();
}

Similar Messages

  • I'm trying to download a game from the app store but nothing happens

    im trying to download Deus Ex: ultimate edition but nothing happens it just stays at 0% and i meet all the requirements i dont know what to do

    HI..
    So your Mac is running v10.7.3 or later? Just making sure. Your profile indicates the iOS 5.1.1 ...
    If you have anti virus software installed, disable that.
    Make sure there's enough free space on the startup disk since the app is 15.51GB.
    Click your Apple menu icon. From the drop down menu click About This Mac then select Storage from the menu.
    Make sure there's a minimum of 15% free disk space.

  • Display an image from an array of bytes

    Hi, I'm trying to display an image from the raw pixel values. lets say i read a bmp file to an array, chuk the header off and want to display the pixel. How can I do this? I don't want any file formats, just want to display the pixels and creat the image. Is this possible?
    Many thanks,
    H

    Thanks for the reply. I had a look at MemoryImageSource and other classes that relates to it. I wrote the example given, but it doesn't identify createImage(). I've implemented ImageProducer, but still complains. Have you any idea why? Thanks for your help.
    H

  • How can I display an image from a shared-network folder?

    Hi
    Does anyone know how I can display images from within APEX that are found outside the database? What configuration have I missed?
    Within Windows-Internet-Explore I can access the following image using the below URLs, BUT I cannot access it from within APEX?
    What do I need to do so APEX can display theses images from our internal shared network folder?
    both these URLs work within Firefox (but on APEX):
    \\Saremote\UPDOWNFILES_DIR\polk_insight.gif
    file://///Saremote/UPDOWNFILES_DIR/polk_insight.GIF
    So within APEX I have created a "display as Text' Item that works with this "amazon image" syntax:
    {lessthan} IMG SRC= {doublequot} http://g-images.amazon.com/images/G/01/associates/navbar2000/logo-no-border(1).gif {doublequot} {greaterthan}
    BUT sadly not with my image:
    {lessthan} IMG SRC= {doublequot} file://///Saremote/UPDOWNFILES_DIR/polk_insight.GIF {doublequot} {greaterthan}
    Any ideas would be appreciated.
    Thanks
    Steve
    Edited by: [email protected] on Sep 12, 2008 8:30 AM
    Edited by: [email protected] on Sep 12, 2008 8:31 AM
    Edited by: [email protected] on Sep 12, 2008 8:32 AM
    Edited by: [email protected] on Sep 12, 2008 8:33 AM

    If you have a local html file, or open an image locally from the menu, then yes, it works, but with web pages that are served from a remote location (web server), security kicks in and prevents the web page from accessing local files (and files on a networked drive).
    you will either have to put the image on the web server and access it through http, or you can load it into the database/workspace images and access it that way.

  • Trying to Display the image

    Hi Steve/anyone
    I am trying to display the image upload and Display using the "Oracle Fusion Developer Guide" page 404 Working with Oracle Multimedia Types by Frank Nimphius and Lynn Munsinger. I tried to replicate the solution in a sample app. My upload works as said. But when i try to browse I dont see the image and i get the following error in the background. Please help. All the steps mentioned have been done
    ! Edit Images.jspx
    <af:inputFile value="#{bindings.Image.inputValue}" simple="true"
    id="if1">
    <binding:convertOrdDomain bindingRef="#{bindings.Image}"/>
    </af:inputFile>
    2 Browse Images.jspx
    <af:panelLabelAndMessage label="#{bindings.Image.hints.label}"
    id="plam1">
    <af:media contentType="#{bindings.Image.inputValue.media.mimeType}"
    source="#{bindings.Image.inputValue.source}" id="m2"/>
    </af:panelLabelAndMessage>
    <af:outputText value="#{bindings.Image.inputValue.media.width}" id="ot3"/>
    java.lang.NullPointerException
         at oracle.ord.html.OrdPlayMediaServlet.renderContent(OrdPlayMediaServlet.java:386)
         at oracle.ord.html.OrdPlayMediaServlet.deliver(OrdPlayMediaServlet.java:264)
         at oracle.ord.html.OrdPlayMediaServlet.doGet(OrdPlayMediaServlet.java:205)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFil

    Error showing images using Servlet OrdPlayMediaServlet

  • Image from Oracle BLOB is not showing

    Hi all!
    Im trying to use this code:
    <?php
    //... etc
    $sql = oci_parse($c, 'select * from pf2.documents ');
    oci_execute($sql);
    echo "<table width = 200 border = 1 cellspacing=0 cellpadding=0>";
    while ($row = oci_fetch_assoc($sql)) {
    echo "<tr>";
    echo"<td style=background-color:#DDDEEE; align=center>";
    echo $row['SHORTNAME'] ;
    echo"</td>";
    echo"<td style=background-color:#DDDEEE; align=center>";
    print $row['FILENAME'] ->load();
    echo"</td>";
    echo "</tr>";
    echo "</table>";
    //... etc
    ?>
    Here im trying to select and publish an image from Oracle BLOB,
    but in Mozilla Firefox im getting just whong text:
    яШяа�JFIF��`�`��яЫ�C� $.' ",#(7),01444'9=82<.342яЫ�C 2!!22222222222222222222222222222222222222222222222222яА�МЂ"�яД����������� яД�µ���}�!1AQa"q2Ѓ‘Ў#B±БRСр$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzѓ„…†‡€‰Љ’“”•–—�™љўЈ¤Ґ¦§Ё©ЄІіґµ¶·ё№єВГДЕЖЗИЙКТУФХЦЧШЩЪбвгдежзийкстуфхцчшщъяД�������� яД�µ��w�!1AQaq"2ЃB‘Ў±Б #3RрbrС $4б%с
    Please help!
    P.S.: Im using PHP 5.2.10 under Wintel platform,
    Oracle 9.2.0.4,
    create table DOCUMENTS
    DOCID NUMBER(10) not null,
    SHORTNAME VARCHAR2(30) not null,
    FULLNAME VARCHAR2(250) not null,
    FILENAME BLOB not null,
    AUTHOR VARCHAR2(30) not null,
    CREATIONDT DATE not null,
    VERSION VARCHAR2(10) not null
    Edited by: user502299 on 28.09.2009 5:33

    I am having a similiar problem. I have created the image.php file:
    <?
    $query = "select a.image_file FROM officer_image a, officer_info b where a.officer_id=b.officer_id and b.officer_lname like 'LEDEZ%' ";
    $stmt = @OCIParse ($db_conn, $query);
    @OCIExecute($stmt, OCI_DEFAULT);
    @OCIFetchInto($stmt, $arr, OCI_ASSOC+OCI_RETURN_LOBS);
    $result = $arr['BLOB'];
    @OCIFreeStatement($stmt);
    @OCILogoff($conn);
    $im = @imagecreatefromstring ($result);
    if (!$im) {
    $im = imagecreate(150, 30);
    $bgc = imagecolorallocate($im, 255, 255, 255);
    $tc = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
    imagestring($im, 1, 5, 5, "", $tc);
    Header("Content-type: image/jpeg");
    Header("Content-Disposition: attachment; filename=filename_".uniqid(time()).".jpg");
    imagejpeg($im,'',100);
    imagedestroy($im);
    ?>
    And then in the actual search web page:
    <?php
              $tname = $_POST['lname'];
              $lname = "{$tname}%";
              $id = "1";
              //$query = "SELECT officer_id, image_file FROM officer_image WHERE ID='.$id.'";
              $query = "select a.image_file FROM officer_image a, officer_info b where a.officer_id=b.officer_id and b.officer_lname like 'LEDEZ%' ";
              //oci_bind_by_name($sql, ":bv", $lname);
              //oci_execute($sql);
              $stid = OCIParse($conn,$query);
              Header("content-type:image/jpeg");
              OCIExecute($stid, OCI_DEFAULT);
              while($succ= OCIFetchInto($stid,$row)) {
                   foreach($row as $item) {
         $blob_message = $item->load();
                   // Output the image
              //imagejpeg($blob_message);
              echo $blob_message . " " ;
              //echo "<img src="image.php?id='.$blob_message.'" border="0">. $rows['officer_id']."\">\n";
              echo "<br /><br />";
                   // Free up memory
              //imagedestroy($im);
              //while ($row = oci_fetch_assoc($sql))
    ?>
    Can anyone help?

  • Can i display all images from databases with adf jsp

    hi
    I want to display all images from the databases whit adf bussines components, because with the sample on http://www.oracle.com/technology/training/products/intermedia/index.html page, i only can display 10 images. i'd lije to know if i can to search in the databases by the id of the image.
    this is the code:
    %@ taglib uri="http://xmlns.oracle.com/adf/ui/jsp/adftags" prefix="adf"%>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    </head>
    <body>
    <html:errors/>
    <table border="1" width="100%">
    <tr>
    <th> </th>
    <th>
    <c:out value="${bindings.ImagenView1.labels['Id']}"/>
    </th>
    <th>
    <c:out value="${bindings.ImagenView1.labels['Descripcion']}"/>
    </th>
    <th>
    <c:out value="${bindings.ImagenView1.labels['Image']}"/>
    </th>
    </tr>
    <c:forEach var="Row" items="${bindings.ImagenView1.rangeSet}">
    <tr>
    <td>
    <c:out value="${Row.currencyString}"/>
    </td>
    <td>
    <c:out value="${Row['Id']}"/> 
    </td>
    <td>
    <adf:render model="Row.Image"/>
    </td>
    <td>
    <c:out value="${Row['Image']}"/> 
    </td>
    </tr>
    </c:forEach>
    </table>
    </body>
    </html>

    I think you want the interMedia JSP tag library...
    http://www.oracle.com/technology/software/products/intermedia/htdocs/descriptions/tag_library.html
    Larry

  • I am trying to import developed images from LightRoom 5 in o Photoshop 6.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, you do not have necessary access permissions or another progra

    I am trying to import developed images from LightRoom 5 Photoshop 6 for further editing.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, or you do not have necessary access permissions or another program is using the file.  Use the 'Properties' command in the Windows Explorer to unlock the file. How do I fix this?  I would greatly appreciate it if you would respond with terms and procedures that a computer ignorant user, such as me, will understand.   Thanks.

    Have you tried restoring the Preferences yet?

  • I am trying to import developed images from LightRoom 5 into Photoshop 6.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, you do not have necessary access permissions or another progra

    I am trying to import developed images from LightRoom 5 into Photoshop 6.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, you do not have necessary access permissions or another program is using the file.  Use the 'properties' command in the Windows Explorer to unlock the file'.  This has not happened before.  How do I change this?

    Could not open a scratch file because the file is locked or you do not have the necessary access privileges. (…) | Mylen…
    Mylenium

  • I am trying to display the output from my ipod touch on apple tv. i can get the audio but no video. please help

    i am trying to display the output from my ipod touch on apple tv. i can get the audio but no video. Thank you for any advice.

    What output are you trying to get to your tv?

  • Want to scan an image from oracle forms -- Is it possible??

    Hi all,
    I want to scan an image from oracle forms through a scanner. I have not found any help on this topic. Pls help with example or code or with demmo form.
    BR
    Tarik.
    Edited by: Tarik_kuet on Sep 9, 2008 1:39 PM
    Edited by: Tarik_kuet on Sep 9, 2008 1:39 PM

    A colleague of me did it like this:
    * the scanner is connected to a network document server.
    * the document server sends(ftp) the image to the oracle XDB
    * a form shows the scanned documents(using a view on the ftp directory in XDB using path_view)
    * in this form the user can move the scanned document(s) to a (blob field) in a table.
    Hope this helps a bit...
    Edited by: poelger on Sep 9, 2008 10:08 AM

  • When trying to open an image from LR4 in Photoshop CS5 I get a message asking me to download Camera

    When trying to open an image from LR4 in Photoshop CS5 I get a message asking me to download Camera Raw 7.0.  This is not on the Adobe web site.  When will it be available?

    <moved from Adobe Creative Cloud to Bridge General Discussion>

  • GetBlob Error During fetching of Images from Oracle 10g

    Dear Sir,
    By using getBlob Function ,i am getting following error:"Unsupportable action has performed".
    I am using oracle 10g.I am using java code to retrieve image from Oracle 10g.
    So plz help me by giving full code with explaination.
    Thankyou.
    Yours Obedient
    Dipesh Kumar

    I seriously doubt Oracle would write error messages with such atrocious English.
    So it's almost certainly an error from either your own code or code you're calling in some library or part of the application you're not mentioning that noone here except you has knowledge of.
    Ergo, we're not going to be able to help you unless you provide a lot more information.
    And no, we're not going to write your code for you.

  • Problem trying to batch resize images from bridge.

    I am trying to batch resize images from bridge. I am on windows 7 desktop and using CC, I select the images in bridge, tool bar>tools>photoshop>image processor. After doing this, photoshop CC opens but no images open.

    open photoshop, open actions pallette, click new action (windows > actions (or Alt+f9)), click record, open your image, resize it, click stop action.
    then use file> automate > batch
    the action you just recorded will be ready to use, select the folder with all your photos (wise to work on a duplicated folder incase you mess up)
    run the action.  wait while photoshop opens and resizes the images one by one.
    check in folder if the images resized how you expected.

  • I want to scan an image from oracle developer 10g ?

    Hi everybody.
    How can I scan an image from oracle developer 10g ?
    thnaks in advance..

    we did this in a similar way RajeshAlex describes.
    We used software "imaging professional" which was able to be controlled via a command-file and told by that command-file to store the scan-result into a local file.
    What we did was:
    Copy command-file to client via WEBUTIL_FILE.AS_TO_CLIENT..
    Execute command-file via WEBUTIL.CLIENT_HOST
    Show Forms-Alert on which the user has to click after scanning was finished
    Check local file which was defined in command-file and, if present, load it into the database using WEBUTIL_FILE.CLIENT_TO_DB..
    Hope this helps

Maybe you are looking for

  • Data Not Found in a Query

    Hi guys, I have built a Query on a Multiprovider which is based on a Remote Cube and Basic Cube.  I can see Data for my filters via ListCube in both Multi Provider and Remote Cube. The Query is showing Data when Restrict to Value Range [First Value,

  • How to create and configure a custom authorization service

    Anyone has any idea how to create a custom authorization module? Can anyone tell me where can I find a documentation or some example how to do it? I appreciate any idea. Regards.

  • How do you delete photos in photo stream?

    How can I delete photos on my photo stream? My daughter added a monster photo that I would like off my phone and iPad. I know how to turn off photo stream i want to delete a photo. Thank you.

  • [XSLT] No support for XSD substitutionGroup functionality?

    I'm getting started with BPEL Process Manager and am currently exploring the functionalities of BPEL JDeveloper. One thing I'm trying to do is see if it has the same capabilities as TIBCO's messagebroker. Although it looked very promising I ran into

  • Slow mac and system break down

    hi there My MacBookPro (2010) started to run slowly. The recent couple of weeks it started to break down too. Last time, just a minute ago. Can anyone make anything out of this crash report, cause I really cannot read programming at all. Any help, re