Viewing Images from Database using JSP/ SQLJ

Dear Friends,
I could manage to write an image into a BLOB Field in the Oracle
Database. I could even manage to read that image from the
database but i am doing it by reading the BLOB data and writing
it into a file with 'gif' or 'jpeg' extension.
I would like to know how to read the BLOB data dynamically in
cache and display it on the JSP page in the browser without
creating a file on the disk.
Thanking you,
Sarwottam

Thanks for replying,
Can you please elaborate on your suggestions ?
If possible can you provide a sample code that would help me understand better?
Thanks again.
Sarwottam

Similar Messages

  • How to insert and view images from oracle using jsf

    Can anyone please give me some code example or link of article explaining that how can i insert and view images to/from oracle using jsf?
    Thanks in advance.

    You mean you want to view image data stored in the database, right?
    Create a servlet that streams the image data to the response (setting the appropriate content-type), then reference this servlet in your img tag. Here is an example:
    http://balusc.blogspot.com/2007/04/imageservlet.html
    Storage is something different. What exactly don't you understand there? Perhaps you want a file upload component?

  • Retieving image from database using webutil

    dear member
    i have 10g db release2, with forms 10g
    i have saved image of the product in a table
    prod_id varchar2(50)
    prodlogo blob(4000)
    how can i retrieve this prodlogo of product on form using webutil or is there any other way of retrieving image.
    thanks.
    teefu.
    lahore,pakistan

    Hi
    You can retrieve the image from the database into a Forms image item, then use client_write_image_file to write this out to the client PC.
    rgds
    Tony

  • Export to Excel from Database using JSP

    Hi Experts,
    I'm using below jsp code to export from an Oracle table to Excel using JSP.
    Every time I run this code I get the exception - "java.lang.OutOfMemoryError: Java heap space".
    I need to download around 8000+ records of the table containing 60 columns.
    I have increased Heap space but still the exception. Below is the code for your reference (I have mentioned only 30 columns where as there are 60 columns in actual). Pls help me what could be the other possible ways or suggest me any alternate code.
    Pls note - Some of the terms like "<serverip>", MySchema, myfile, COL names are changed for confidentiality.
    "D:\\Myfolder\\Excelfolder\\Final.xls" exists my the local machine.
    The code works until some 4000 records & after that throws the exception.
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@<serverip>:1521:WISTGDEV", "user", "user@123");
    Statement statement = connection.createStatement();
    String filename = "C:\\Myfolder\\Excelfolder\\Final.xls";
    String strQuery1 = ("select * from Myschema.myfile");
    ResultSet rs = statement.executeQuery(strQuery1);
    HSSFWorkbook hwb = new HSSFWorkbook();
    HSSFSheet sheet = hwb.createSheet("sheet1");
    HSSFRow rowhead = sheet.createRow((short)0);
    rowhead.createCell((short) 0).setCellValue("COL1");
    rowhead.createCell((short) 1).setCellValue("COL2");
    rowhead.createCell((short) 2).setCellValue("COL3");
    rowhead.createCell((short) 3).setCellValue("COL4");
    rowhead.createCell((short) 4).setCellValue("COL5");
    rowhead.createCell((short) 5).setCellValue("COL6");
    rowhead.createCell((short) 6).setCellValue("COL7");
    rowhead.createCell((short) 7).setCellValue("COL8");
    rowhead.createCell((short) 8).setCellValue("COL9");
    rowhead.createCell((short) 9).setCellValue("COL10");
    rowhead.createCell((short) 10).setCellValue("COL11");
    rowhead.createCell((short) 11).setCellValue("COL12");
    rowhead.createCell((short) 12).setCellValue("COL13");
    rowhead.createCell((short) 13).setCellValue("COL14");
    rowhead.createCell((short) 14).setCellValue("COL15");
    rowhead.createCell((short) 15).setCellValue("COL16");
    rowhead.createCell((short) 16).setCellValue("COL17");
    rowhead.createCell((short) 17).setCellValue("COL18");
    rowhead.createCell((short) 18).setCellValue("COL19");
    rowhead.createCell((short) 19).setCellValue("COL20");
    rowhead.createCell((short) 20).setCellValue("COL21");
    rowhead.createCell((short) 21).setCellValue("COL22");
    rowhead.createCell((short) 22).setCellValue("COL23");
    rowhead.createCell((short) 23).setCellValue("COL24");
    rowhead.createCell((short) 24).setCellValue("COL25");
    rowhead.createCell((short) 25).setCellValue("COL26");
    rowhead.createCell((short) 26).setCellValue("COL27");
    rowhead.createCell((short) 27).setCellValue("COL28");
    rowhead.createCell((short) 28).setCellValue("COL29");
    rowhead.createCell((short) 29).setCellValue("COL30");
    int index=1
    String name="";
    while(rs.next())
    System.out.println("Inside while");
    HSSFRow row = sheet.createRow((short)index);
    row.createCell((short) 0).setCellValue(rs.getString(2));
    row.createCell((short) 1).setCellValue(rs.getString(3));
    row.createCell((short) 2).setCellValue(rs.getString(4));
    row.createCell((short) 13).setCellValue(rs.getFloat(5));
    row.createCell((short) 4).setCellValue(rs.getString(6));
    row.createCell((short) 5).setCellValue(rs.getString(7));
    row.createCell((short) 6).setCellValue(rs.getInt(8));
    row.createCell((short) 7).setCellValue(rs.getString(9));
    row.createCell((short) 8).setCellValue(rs.getString(10));
    row.createCell((short) 9).setCellValue(rs.getString(11));
    row.createCell((short) 10).setCellValue(rs.getString(12));
    row.createCell((short) 11).setCellValue(rs.getFloat(13));
    row.createCell((short) 12).setCellValue(rs.getFloat(14));
    row.createCell((short) 13).setCellValue(rs.getFloat(15));
    row.createCell((short) 14).setCellValue(rs.getFloat(16));
    row.createCell((short) 15).setCellValue(rs.getFloat(17));
    row.createCell((short) 16).setCellValue(rs.getFloat(18));
    row.createCell((short) 17).setCellValue(rs.getFloat(19));
    row.createCell((short) 18).setCellValue(rs.getFloat(20));
    row.createCell((short) 19).setCellValue(rs.getFloat(21));
    row.createCell((short) 20).setCellValue(rs.getFloat(22));
    row.createCell((short) 21).setCellValue(rs.getString(23));
    row.createCell((short) 22).setCellValue(rs.getString(24));
    row.createCell((short) 23).setCellValue(rs.getString(25));
    row.createCell((short) 24).setCellValue(rs.getString(26));
    row.createCell((short) 25).setCellValue(rs.getString(27));
    row.createCell((short) 26).setCellValue(rs.getString(28));
    row.createCell((short) 27).setCellValue(rs.getString(29));
    row.createCell((short) 28).setCellValue(rs.getString(30));
    index++;
    rs.close();
    FileOutputStream fileOut = new FileOutputStream(filename);
    hwb.write(fileOut);
    fileOut.close();
    connection.close();
    catch(Exception e)
    System.out.println(e.getMessage());
    e.printStackTrace();
    Thanks in advance,
    Venky
    Edited by: Venky_86 on Apr 15, 2009 12:06 AM

    Its is an obvious thing...POI is known to need a lot of memory (the reason for that is most likely the OLE document format, which is quite complex).
    I would have used something like the below to see if that can address my client's requirement.
    public exportExcel(String fileName){
       Connection connection = null;
       Statement statement = null;
       ResultSet rs = null;
       PrintWriter out = null;
       int index=1;
       try{
         out = new PrintWrite(new FileWriter(fileName));
         connection = DbUtils.getConnection();
         statement = connection.createStatement();
         rs = statement.executeQuery("select * from Myschema.myfile");
         out.prinln("<table>");
         out.println("<th>COL1</th>");
         out.println("<th>COL2</th>");
         out.println("<th>COL3</th>");
         out.println("<th>COL4</th>");
         out.println("<th>COL5</th>");
         out.println("<th>COL6</th>");
         out.println("<th>COL7</th>");
         out.println("<th>COL8</th>");
         out.println("<th>COL9</th>");
        out.println("<th>COL30</th>");
         out.println("<thead>");
         out.println("<tbody>");
         while(rs.next()){
              out.println("<td>"+index+"</td>");
              out.println("<td>"+rs.getString(2)+"<td>");        
              out.println("<td>"+rs.getString(3)+"<td>");        
              out.println("<td>"+rs.getString(4)+"<td>");        
              out.println("<td>"+rs.getString(5)+"<td>");        
              out.println("<td>"+rs.getString(6)+"<td>");        
              out.println("<td>"+rs.getString(7)+"<td>");        
              out.println("<td>"+rs.getString(8)+"<td>");        
              out.println("<td>"+rs.getString(9)+"<td>");        
              out.println("<td>"+rs.getString(30)+"<td>");        
         out.println("</tbody>")     
         out.println("</table>");    
         out.flush(); 
       }catch(Exception exp){
           exp.printStackTrace();
       }finally{
           if(out != null)
            try{out.close();}catch(Exception e){}
             if(rs != null)
               try{rs.close();}catch(Exception e){}
            if(statement != null)
               try{statement.close();}catch(Exception e){}
             if(connection != null)
               try{connection.close();}catch(Exception e){}
    }and you can simply export the file using the method
    ApplicationUtils.getInstance().exportExcel("c:/export/myapp/ApplicationTable.xls");If you are using Office 2000 and above you should able open it as an excel worksheet without any problems.
    Hope that help :)
    REGARDS,
    RaHuL

  • Invalid File after Downloading from Database using JSP/JDev 10.1.2

    Hi, i got a problem when i download a file from my blobColumn in database.
    Well, actually i got no problem in reading the file out of database, but when i download this file, there are 3 more bytes then in the original one in Database...
    Here's my java-code in the jsp-page i used as "save as" field:
    Hashtable ht = Dokument.createDOK(request);
    String dateiname = (String)ht.get("Dateiname");
    byte[] fileBytes = (byte[])ht.get("Dokument");
    ByteArrayOutputStream ba = new ByteArrayOutputStream();
    ba.write(fileBytes);
    // RESPONSE
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition","attachment; filename=\"" + dateiname + "\"");
    // DOWNLOAD
    OutputStream outs = response.getOutputStream();
    ba.writeTo(outs);
    outs.flush();
    outs.close();
    }catch(Exception ex){
    ex.printStackTrace();
    for testing i used a simple text file with 28bytes:
    begin----
    Test Zeile 1.
    Test Zeile 2.
    end-------
    after downloading this file it looks like:
    begin----
    Test Zeile 1.
    Test Zeile 2.
    end-------
    There are 3 bytes 0A(hex) at the beginning...
    I dont know why.
    after closing "outs" i made system.out for checking the amount of bytes in "fileBytes"-Array, and it was correct, just the 28 bytes like in the file from the Database.
    But i actually dont get, why there are 3 more bytes at the beginning after downloading it.
    The main problem is, some other files like word or excel documents cannt be opened, because of this 3 bytes at the beginning, and they seem to be invalid.
    Would be glad if someone can help me, got really stuck and have no idea any more.
    Thanks
    Sebastian

    Dont someone has a solution, or got a similar problem ?
    Thought about it could be a bug in the basic java classes of JDev 10.1.2
    but i dont really know...
    Have no idea left.
    Sebastian

  • Fetch Data from Database using JSP

    Dear friends,
    I am developing a portal for my College. The theme is to automate student details.
    Here i have Screens for Posting, Editing , Viewing.
    In Editing: I fetch the data from the backend using select query.
    In the address field: I have value as "Big House".
    The user keyed with double quotes when he keyed.
    During extraction of the data i put the value inside a textbox as
    <input type=text name=st1 value="<%=res.getString("street1")%>">
    Here,
    the value becomes as
    <input type=text name=st1 value=""Big House "">
    Here, you can notice that Big house i prefixed by double -double quotes.
    The value should be Big House but the values is empty.
    What i should. ???
    Thanks in Advance.
    Rengaraj.R

    Try this:
    <%
    String addr = res.getString("street1");
    //escape the double quotes from the address
    addr = addr.replaceAll("[\"]",""");
    %>
    <input type="text" name="st1" value="<%=addr%>">

  • How to retrieve image in BLOB in oracle database using JSP?

    do any one the method to view image in homepage using jsp from BLOB field in oracle database ?
    thx

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Bon BOn:
    do any one the method to view image in homepage using jsp from BLOB field in oracle database ?
    thx<HR></BLOCKQUOTE>
    I am using a servlet that retrieves the BLOB from the database, sets the MIME type and puts it in a stream. The code is :
    package TestQueryITM;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.OracleDriver;
    import oracle.jdbc.driver.*;
    public class MIMEServlet extends HttpServlet {
    DbConnect myDbBean = new DbConnect();
    int Id=6;
    String MIME ="plain/text";
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest req,HttpServletResponse res)
    throws ServletException, IOException
    try
    String content_type = new String();
    String filename = new String();
    // Load the Oracle JDBC driver:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Connect to the database:
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@ORAVISION:1521:DEV","[username]", "[password]");
    // It's faster when auto commit is off:
    conn.setAutoCommit (false);
    // Create a Statement:
    Statement stmt = conn.createStatement ();
    try
    BLOB lob_loc = null;
    java.io.InputStream in = null;
    int pos = 0;
    int length = 0;
    OracleResultSet rset = (OracleResultSet) stmt.executeQuery (
    "SELECT text FROM test WHERE ID = "+Id);
    if (rset.next())
    lob_loc = ((OracleResultSet)rset).getBLOB(1);
    MIME=rset.getString(2);
    // File binaryFile = new File("C:/aantekeningen.doc");
    // FileInputStream in = new FileInputStream(binaryFile);
    in = lob_loc.getBinaryStream();
    // This loop fills the buf iteratively, retrieving data // from the InputStream:
    res.setContentType (application/pdf);
    res.setHeader ("Content-Disposition","attachement;filename=test.doc");
    ServletOutputStream op = res.getOutputStream ();
    byte[] buffer = new byte[32000];
    while ((in != null) && ((length = in.read(buffer)) != -1))
    // the data has already been read into buf
    System.out.println("Bytes read in: " +
    Integer.toString(length));
    op.write(buffer,0,length);
    op.flush();
    op.close ();
    in.close();
    stmt.close();
    conn.commit();
    conn.close();
    }catch (SQLException e)
    e.printStackTrace();
    }catch(Exception e)
    System.out.println("<BR>");
    e.printStackTrace();
    System.out.println("<BR>");
    public String getServletInfo() {
    return "TestQueryITM.MIMEServlet Information";
    null

  • Browse image from database

    hi evey body
    i wish some one help me for solve this problem .
    when i use jdeveloper 11g to browse image from database using servlet (*without using Dynamic JDBC Credentials*) i can browse the image,
    but when i use jdeveloper 11g to browse image from database using servlet with the solution by Steve Muench, Dynamic JDBC Credentials i always get this error :
    java.Null.pointerException
    Caused By: java.sql.SQLException: ORA-01005: null password given; logon denied
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:406)
    Truncated. see log file for complete stacktrace .
    my question why i get this error? is servlet open new session ??
    thanks in advance
    maher

    hi every body
    sorry for my repeated request , i wish some body help me to solve my problem or ask me some thing about my problem .
    this the last request for this question and i will not upset you again .
    thanks in advance
    maher

  • How to store and retrieve images from database...

    Hi All
    Anubody tell me plz how to store images in database using jsp.
    and how to retrieve tme.
    Plz reply...
    Anurag

    Exactly
    try the links below may be those might help u in store and retrieval any kind of file.
    http://www.mysqltalk.org/insert-blob-example-vt112861.html
    https://java.sun.com/j2se/1.5.0/docs/guide/jdbc/blob.html
    http://javaalmanac.com/egs/java.sql/GetBlob.html
    http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.jdbc.doc/jdbc142.htm
    and a dearly advice friend please query google b4 you post any query out here.

  • View in image from database

    hi will i be able to view image from my database using this class, am using jdeveloper 11g release 2
    package TaskFlowView;
    import java.io.BufferedInputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.sql.DataSource;
    public class ImageServlet extends HttpServlet {
        private static final String CONTENT_TYPE =
            "image/jpg; charset=utf-8";
         * @param config
         * @throws ServletException
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
         * @param request
         * @param response
         * @throws ServletException
         * @throws IOException
        public void doGet(HttpServletRequest request,
                          HttpServletResponse response) throws ServletException,
                                                               IOException {
            response.setContentType(CONTENT_TYPE);
            response.setContentType(CONTENT_TYPE);
            String detailDocumentId = request.getParameter("detail");
            String thumbnailDocumentId = request.getParameter("thumbnail");
            boolean thumbnail = true;
            String DocumentId = null;
            OutputStream os = response.getOutputStream();
            Connection conn = null;
            try {
                Context ctx = new InitialContext();
                DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/SMSDEV");
                conn = ds.getConnection();
                PreparedStatement statement = conn.prepareStatement(
                  "SELECT file_name, " +
                  "dlin.id, " +
                  "FROM  sms_document_links dlin " +
                  "sms_document_references dref" +
                  "WHERE dref.id = ?" +
                  "dref.dlin_id = dlin.id");
                if (detailDocumentId != null) {
                    DocumentId = detailDocumentId;
                    thumbnail = false;
                } else {
                    DocumentId = thumbnailDocumentId;
                statement.setString(1,(thumbnail ? "Y" : "N"));           
                statement.setInt(2, new Integer(DocumentId));
                ResultSet rs = statement.executeQuery();
                if (rs.next()) {
                    Blob blob = rs.getBlob("IMAGE");
                    BufferedInputStream in = new BufferedInputStream(blob.getBinaryStream());
                    int b; byte[] buffer = new byte[10240];
                    while ((b = in.read(buffer, 0, 10240)) != -1) { os.write(buffer, 0, b); }
                    os.close();
            } catch (Exception e){
                System.out.println(e);
            } finally {
                try{
                    if (conn != null){
                         conn.close();
                 } catch (SQLException sqle){
                     System.out.println("SQLException error");
        }Edited by: Tshifhiwa on 2012/05/29 1:52 PM
    Edited by: Tshifhiwa on 2012/05/29 1:56 PM

    hi this what i have done, am still having error with my iterator line= DCIteratorBinding lBinding = lBindingContainer.findIteratorBinding(sms4200ModuleDataControlIter),the error say type or variable sms4200ModuleDataControlIter not found but thats the name in my page defination,and is this the class i must write this method
    import com.sun.rowset.internal.Row;
    import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.sql.SQLException;
    import oracle.jbo.domain.BlobDomain;
    import oracle.jbo.domain.Timestamp;
    import oracle.jbo.server.AttributeDefImpl;
    import oracle.jbo.server.EntityImpl;
    import oracle.jbo.server.ViewRowImpl;
    import javax.faces.event.ValueChangeEvent;
    import org.apache.myfaces.trinidad.model.UploadedFile;
    import javax.faces.application.FacesMessage;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ValueChangeEvent;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCIteratorBindingDef;
    import sms4200.common.SmsDocumentLinksViewRow;
    import sun.misc.IOUtils;
    // ---    File generated by Oracle ADF Business Components Design Time.
    // ---    Wed May 30 13:12:49 CAT 2012
    // ---    Custom code may be added to this class.
    // ---    Warning: Do not modify method signatures of generated methods.
    public class SmsDocumentLinksViewRowImpl extends ViewRowImpl implements SmsDocumentLinksViewRow {
        public static final int ENTITY_SMSDOCUMENTLINKS = 0;
        private static final String CONTENT_TYPE =
            "image/jpg; charset=utf-8";
            DocumentImage {
                public Object get(SmsDocumentLinksViewRowImpl obj) {
                    return obj.getDocumentImage();
                public void put(SmsDocumentLinksViewRowImpl obj, Object value) {
                    obj.setDocumentImage((BlobDomain)value);
      public static final int DOCUMENTIMAGE = AttributesEnum.DocumentImage.index();
        public BlobDomain getDocumentImage() {
            return (BlobDomain) getAttributeInternal(DOCUMENTIMAGE);
         * Sets <code>value</code> as attribute value for DOCUMENT_IMAGE using the alias name DocumentImage.
         * @param value value to set the DOCUMENT_IMAGE
        public void setDocumentImage(BlobDomain value) {
            setAttributeInternal(DOCUMENTIMAGE, value);
        private BlobDomain createBlobDomain(UploadedFile file)
            // init the internal variables
            InputStream in = null;
            BlobDomain blobDomain = null;
            OutputStream out = null;
            try
                // Get the input stream representing the data from the client
                in = file.getInputStream();
                // create the BlobDomain datatype to store the data in the db
                blobDomain = new BlobDomain();
                // get the outputStream for hte BlobDomain
                out = blobDomain.getBinaryOutputStream();
                // copy the input stream into the output stream
        39               * IOUtils is a class from the Apache Commons IO Package (http://www.apache.org/)
        40               * Here version 2.0.1 is used
        41               * please download it directly from http://projects.apache.org/projects/commons_io.html
        42               */
                IOUtils.copy(in, out);
            catch (IOException e)
                e.printStackTrace();
            catch (SQLException e)
                e.fillInStackTrace();
            // return the filled BlobDomain
            return blobDomain;
        public void uploadFileValueChangeEvent(ValueChangeEvent valueChangeEvent){
                    // The event give access to an Uploade dFile which contains data about the file and its content
                    // Get the original file name
                    UploadedFile file = (UploadedFile) valueChangeEvent.getNewValue();
                    // Get the original file name
                    String fileName = file.getFilename();
                    String contentType = CONTENT_TYPE.valueOf(fileName);
                        //get(fileName);
                    // get the current roew from the ImagesView2Iterator via the binding
                    DCBindingContainer lBindingContainer =
                        (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
                   // DCIteratorBinding lBinding = lBindingContainer.findIteratorBinding(&quot;sms4200ModuleDataControlIter&quot;);
                      DCIteratorBinding lBinding = lBindingContainer.findIteratorBinding(sms4200ModuleDataControlIter);
                    Row newRow = (Row)lBinding.getCurrentRow();
                    // set the file name
                    //newRow.setAttribute(&quot;DOCUMENTIMAGE&quot; fileName);
                    newRow.setColumnObject(DOCUMENTIMAGE, fileName);
                    // create the BlobDomain and set it into the row
                   // newRow.setAttribute(DOCUMENTIMAGE, createBlobDomain(file));
                    newRow.setColumnObject(DOCUMENTIMAGE, createBlobDomain(file));
                    // set the mime type
                    //newRow.setAttribute(&quot;ContentType&quot;, contentType);
                    newRow.setColumnObject(DOCUMENTIMAGE,contentType);                                                       
    my PageDef file is
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="11.1.2.60.81" id="sms4200PageDef"
                    Package="SmsFrontUI.pageDefs">
      <parameters/>
      <executables>
        <variableIterator id="variables"/>
        <iterator Binds="ViewObj1" RangeSize="25" DataControl="TaskFlowAppModuleDataControl" id="ViewObj1Iterator"/>
        <iterator Binds="sms4200_1" RangeSize="25" DataControl="TaskFlowAppModuleDataControl" id="sms4200_1Iterator"/>
        <iterator id="sms4200ModuleDataControlIter" DataControl="sms4200ModuleDataControl" RangeSize="25"
                  Binds="SmsDocumentLinksView1"/>
      </executables>
      <bindings>
        <attributeValues IterBinding="ViewObj1Iterator" id="IntegrationTypeName">
          <AttrNames>
            <Item Value="IntegrationTypeName"/>
          </AttrNames>
        </attributeValues>
        <attributeValues IterBinding="ViewObj1Iterator" id="Name">
          <AttrNames>
            <Item Value="Name"/>
          </AttrNames>
        </attributeValues>
        <attributeValues IterBinding="ViewObj1Iterator" id="LocalUpDirectory">
          <AttrNames>
            <Item Value="LocalUpDirectory"/>
          </AttrNames>
        </attributeValues>
        <attributeValues IterBinding="sms4200_1Iterator" id="IntegrationTypeName1">
          <AttrNames>
            <Item Value="IntegrationTypeName"/>
          </AttrNames>
        </attributeValues>
        <attributeValues IterBinding="sms4200_1Iterator" id="Name1">
          <AttrNames>
            <Item Value="Name"/>
          </AttrNames>
        </attributeValues>
        <attributeValues IterBinding="sms4200_1Iterator" id="LocalUpDirectory1">
          <AttrNames>
            <Item Value="LocalUpDirectory"/>
          </AttrNames>
        </attributeValues>
      </bindings>
    </pageDefinition>and my view is
    <?xml version="1.0" encoding="windows-1252" ?>
    <!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
    <!---->
    <ViewObject
      xmlns="http://xmlns.oracle.com/bc4j"
      Name="SmsDocumentLinksView"
      Version="11.1.2.60.81"
      SelectList="SmsDocumentLinks.ID,
           SmsDocumentLinks.EDRMS_ID,
           SmsDocumentLinks.FILE_PLAN_NO,
           SmsDocumentLinks.DOCUMENT_NAME,
           SmsDocumentLinks.SCAN_DT,
           SmsDocumentLinks.DATE_CREATED,
           SmsDocumentLinks.DATE_MODIFIED,
           SmsDocumentLinks.MODIFIED_BY,
           SmsDocumentLinks.CREATED_BY,
           SmsDocumentLinks.DOCUMENT_IMAGE,
           SmsDocumentLinks.DITYP_ID,
           SmsDocumentLinks.DWSTA_CODE,
           SmsDocumentLinks.SOURCE_FILE_NAME"
      FromList="SMS_DOCUMENT_LINKS SmsDocumentLinks"
      BindingStyle="OracleName"
      CustomQuery="false"
      PageIterMode="Full"
      UseGlueCode="false"
      RowClass="sms4200.SmsDocumentLinksViewRowImpl"
      ComponentClass="sms4200.SmsDocumentLinksViewImpl"
      RowInterface="sms4200.common.SmsDocumentLinksViewRow"
      ClientRowProxyName="sms4200.client.SmsDocumentLinksViewRowClient">
      <DesignTime>
        <Attr Name="_codeGenFlag2" Value="Access|Coll|Prog|VarAccess"/>
        <Attr Name="_isCodegen" Value="true"/>
      </DesignTime>
      <EntityUsage
        Name="SmsDocumentLinks"
        Entity="sms4200.SmsDocumentLinks"/>
      <ViewAttribute
        Name="Id"
        IsNotNull="true"
        PrecisionRule="true"
        EntityAttrName="Id"
        EntityUsage="SmsDocumentLinks"
        AliasName="ID">
        <TransientExpression><![CDATA[(new oracle.jbo.server.SequenceImpl("SMS_CAT_SEQ",adf.object.getDBTransaction())).getSequenceNumber()]]></TransientExpression>
      </ViewAttribute>
      <ViewAttribute
        Name="EdrmsId"
        PrecisionRule="true"
        EntityAttrName="EdrmsId"
        EntityUsage="SmsDocumentLinks"
        AliasName="EDRMS_ID"/>
      <ViewAttribute
        Name="FilePlanNo"
        PrecisionRule="true"
        EntityAttrName="FilePlanNo"
        EntityUsage="SmsDocumentLinks"
        AliasName="FILE_PLAN_NO"/>
      <ViewAttribute
        Name="DocumentName"
        PrecisionRule="true"
        EntityAttrName="DocumentName"
        EntityUsage="SmsDocumentLinks"
        AliasName="DOCUMENT_NAME"/>
      <ViewAttribute
        Name="ScanDt"
        PrecisionRule="true"
        EntityAttrName="ScanDt"
        EntityUsage="SmsDocumentLinks"
        AliasName="SCAN_DT"/>
      <ViewAttribute
        Name="DateCreated"
        PrecisionRule="true"
        EntityAttrName="DateCreated"
        EntityUsage="SmsDocumentLinks"
        AliasName="DATE_CREATED"/>
      <ViewAttribute
        Name="DateModified"
        PrecisionRule="true"
        EntityAttrName="DateModified"
        EntityUsage="SmsDocumentLinks"
        AliasName="DATE_MODIFIED"/>
      <ViewAttribute
        Name="ModifiedBy"
        PrecisionRule="true"
        EntityAttrName="ModifiedBy"
        EntityUsage="SmsDocumentLinks"
        AliasName="MODIFIED_BY"/>
      <ViewAttribute
        Name="CreatedBy"
        PrecisionRule="true"
        EntityAttrName="CreatedBy"
        EntityUsage="SmsDocumentLinks"
        AliasName="CREATED_BY"/>
      <ViewAttribute
        Name="DocumentImage"
        IsQueriable="false"
        PrecisionRule="true"
        EntityAttrName="DocumentImage"
        EntityUsage="SmsDocumentLinks"
        AliasName="DOCUMENT_IMAGE"/>
      <ViewAttribute
        Name="DitypId"
        PrecisionRule="true"
        EntityAttrName="DitypId"
        EntityUsage="SmsDocumentLinks"
        AliasName="DITYP_ID"/>
      <ViewAttribute
        Name="DwstaCode"
        PrecisionRule="true"
        EntityAttrName="DwstaCode"
        EntityUsage="SmsDocumentLinks"
        AliasName="DWSTA_CODE"/>
      <ViewAttribute
        Name="SourceFileName"
        PrecisionRule="true"
        EntityAttrName="SourceFileName"
        EntityUsage="SmsDocumentLinks"
        AliasName="SOURCE_FILE_NAME"/>
    </ViewObject>Edited by: Tshifhiwa on 2012/05/30 8:57 PM

  • Error while getting  image from database in SUP using ios?

    Hi All,
      Im developing native iOS application using sup 2.1.3 . Im getting error While retrieving  image from SUP database. Here i'm trying to get image from database and show in imageView.can any one help me how to fix this issue?
    In database image datatype is  'LONG Binary' .
    My table Schema:
    CREATE TABLE dba.ImagesTable (
    RowID INT NOT NULL,
    ImageName VARCHAR(20) NOT NULL,
    PhotoData LONG BINARY NOT NULL,
    IN SYSTEM
    ALTER TABLE dba.ImagesTable
      ADD CONSTRAINT ASA137 PRIMARY KEY CLUSTERED (RowID)
    ALTER TABLE dba.ImagesTable
      ADD CONSTRAINT ASA138 UNIQUE NONCLUSTERED (RowID)
    in Xcode:
                [SUP107SUP107DB synchronize];
                SUP107ImagesTable *imgTable =[[SUP107ImagesTable alloc]init];
                SUP107ImagesTableList *list =[SUP107ImagesTable findAll];
                SUP107ImagesTable * oneRecord =[list objectAtIndex:0];
                NSLog(@"rowId:%d---imageName:%@---photoData:%@---photoLenght:%d",oneRecord.rowID,oneRecord.imageName,oneRecord.photoData,oneRecord.photoDataLength);
                NSData *tempData =[[NSData alloc]init];
                SUPBigBinary *responseBinaryData = (SUPBigBinary *)oneRecord.photoData.value;
                @try {
                    [responseBinaryData openForWrite:[oneRecord.photoData length]];
                    [responseBinaryData write:tempData];
                @catch (NSException *exception) {
                    NSLog(@"exception: %@",[exception description]);
                UIImageView *imgView =[[UIImageView alloc] initWithFrame:CGRectMake(50,50,100,100)];
                [self.window addSubview:imgView];
                UIImage * tempImage =[UIImage imageWithData:tempData];
                imgView.image = tempImage;
                [responseBinaryData close];
    Error Log:
    2014-04-02 18:42:15.150 SUP102[2873:70b] rowId:1---imageName:Apple---photoData:SUPBigBinary: column=c pending=1 allow_pending_state=1 table=sup107_1_0_imagestable mbo=0x0 key=(null) ---photoLenght:90656
    Printing description of responseBinaryData:
    <OS_dispatch_data: data[0xc891b40] = { leaf, size = 90656, buf = 0x1213a000 }>
    2014-04-02 18:42:33.304 SUP102[2873:70b] -[OS_dispatch_data openForWrite:]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.305 SUP102[2873:70b] exception: -[OS_dispatch_data openForWrite:]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.305 SUP102[2873:70b] -[OS_dispatch_data close]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.306 SUP102[2873:70b] [ERROR] [AppDelegate.m:497] NSInvalidArgumentException: -[OS_dispatch_data close]: unrecognized selector sent to instance 0xc891b40

    This thread talks about uploading image to SAP from a IOS device,Sending Image to SAP via iOS Native app (SUP 2.1.3)
    Midhun VP

  • How to store and retrieve blob data type in/from oracle database using JSP

    how to store and retrieve blob data type in/from oracle database using JSP and not using servlet
    thanks

    JSP? Why?
    start here: [http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html]

  • Not able to download image from database

    not able to download image from database am in jdeveloper 11g release 2 am using this example
    : http://tompeez.wordpress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-2/
    hi am not able to down load my image my jsp xml is
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document title="sms4200.jspx" id="d1">
    <af:messages id="m1"/>
    <af:form id="f1" usesUpload="true">
    <af:panelStretchLayout topHeight="211px" id="psl1" inlineStyle="width:1338px; background-color:Navy;">
    <f:facet name="top">
    <af:panelHeader text="Sms Intergration Sources" id="ph1">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    <af:panelStretchLayout id="psl2" inlineStyle="height:178px; width:1018px;" topHeight="22px"
    endWidth="589px" startWidth="55px" bottomHeight="33px">
    <f:facet name="end">
    <af:panelHeader text="Office" id="ph2"
    inlineStyle="width:900px; background-color:Navy;">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    <af:panelFormLayout id="pfl3" inlineStyle="background-color:Navy;" rows="1">
    <f:facet name="footer"/>
    <af:inputText label="#{bindings.Name1.hints.label}"
    required="#{bindings.Name1.hints.mandatory}"
    columns="20"
    maximumLength="#{bindings.Name1.hints.precision}"
    shortDesc="#{bindings.Name1.hints.tooltip}" id="it2">
    <f:validator binding="#{bindings.Name1.validator}"/>
    </af:inputText>
    <af:inputText
    label="#{bindings.LocalUpDirectory1.hints.label}"
    required="#{bindings.LocalUpDirectory1.hints.mandatory}"
    columns="20"
    maximumLength="#{bindings.LocalUpDirectory1.hints.precision}"
    shortDesc="#{bindings.LocalUpDirectory1.hints.tooltip}"
    id="it3">
    <f:validator binding="#{bindings.LocalUpDirectory1.validator}"/>
    </af:inputText>
    </af:panelFormLayout>
    </af:panelHeader>
    </f:facet>
    <f:facet name="top">
    <af:inputText value="#{bindings.IntegrationTypeName1.inputValue}"
    label="#{bindings.IntegrationTypeName1.hints.label}"
    required="#{bindings.IntegrationTypeName1.hints.mandatory}"
    columns="#{bindings.IntegrationTypeName1.hints.displayWidth}"
    maximumLength="#{bindings.IntegrationTypeName1.hints.precision}"
    shortDesc="#{bindings.IntegrationTypeName1.hints.tooltip}" id="it1">
    <f:validator binding="#{bindings.IntegrationTypeName1.validator}"/>
    </af:inputText>
    </f:facet>
    </af:panelStretchLayout>
    </af:panelHeader>
    </f:facet>
    <f:facet name="center">
    <!-- id="af_one_column_header_stretched" -->
    <af:decorativeBox theme="dark" id="db1" inlineStyle="width:1050px; background-color:Navy;">
    <f:facet name="center">
    <af:panelGroupLayout layout="scroll" id="pgl3" inlineStyle="background-color:Navy;">
    <af:panelStretchLayout id="psl3" inlineStyle="width:1012px; height:502px;"
    topHeight="133px" startWidth="0px">
    <f:facet name="center">
    <af:panelStretchLayout id="psl5" endWidth="659px" startWidth="171px">
    <f:facet name="center"/>
    <f:facet name="start"/>
    <f:facet name="end">
    <af:panelGroupLayout layout="scroll" id="pgl2">
    <af:inputFile label="Select Image" id="if1" autoSubmit="true"
    valueChangeListener="#{ImageBean.uploadFileValueChangeEvent}"/>
    <af:commandButton actionListener="#{bindings.CreateInsert.execute}"
    text="Restart Load Image Process"
    disabled="#{!bindings.CreateInsert.enabled}"
    id="cb2"/>
    <af:commandButton actionListener="#{bindings.Commit.execute}"
    text="Save"
    disabled="#{!bindings.Commit.enabled}"
    id="cb3"/>
    <af:commandButton text="View" id="cb1"
    partialSubmit="true"
    unsecure="#{ImageBean.downloadButton}"
    action="#{image.downloadImage}"
    binding="#{image2.downloadButton}"/>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="top"/>
    </af:panelStretchLayout>
    </f:facet>
    <f:facet name="start"/>
    <f:facet name="top">
    <af:panelStretchLayout id="psl4" startWidth="232px" endWidth="296px"
    bottomHeight="18px" topHeight="11px">
    <f:facet name="bottom"/>
    <f:facet name="center"/>
    <f:facet name="start">
    <af:panelFormLayout id="pfl1" labelAlignment="top">
    <f:facet name="footer"/>
    <af:inputText label="File from PC to be Transfered" id="it4"/>
    </af:panelFormLayout>
    </f:facet>
    <f:facet name="end">
    <af:panelFormLayout id="pfl2" labelAlignment="top" maxColumns="10">
    <f:facet name="footer">
    <af:inputText value="#{bindings.DocumentName.inputValue}"
    label="File Transfered to Database"
    required="#{bindings.DocumentName.hints.mandatory}"
    columns="50"
    rows="1"
    maximumLength="#{bindings.DocumentName.hints.precision}"
    shortDesc="#{bindings.DocumentName.hints.tooltip}"
    id="it5" simple="false">
    <f:validator binding="#{bindings.DocumentName.validator}"/>
    </af:inputText>
    </f:facet>
    </af:panelFormLayout>
    </f:facet>
    <f:facet name="top"/>
    </af:panelStretchLayout>
    </f:facet>
    </af:panelStretchLayout>
    </af:panelGroupLayout>
    </f:facet>
    </af:decorativeBox>
    </f:facet>
    </af:panelStretchLayout>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    and my log file is
    <ViewHandlerImpl> <_checkTimestamp> Apache Trinidad is running with time-stamp checking enabled. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
    <UIXEditableValue> <_isBeanValidationAvailable> A Bean Validation provider is not present, therefore bean validation is disabled
    the method am calling is
        public BlobDomain downloadImage() {
            FacesContext facesContext = null;
            OutputStream outputStream = null;
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            // get an ADF attributevalue from the ADF page definitions
            AttributeBinding attr = (AttributeBinding)bindings.getControlBinding("Documentimage");
            if (attr == null) {
                return null;
            // the value is a BlobDomain data type
            BlobDomain blob = (BlobDomain)attr.getInputValue();
            try { // copy hte data from the BlobDomain to the output stream
                IOUtils.copy(blob.getInputStream(), outputStream);
                // cloase the blob to release the recources
                blob.closeInputStream();
                // flush the outout stream
                outputStream.flush();
            } catch (IOException e) {
                // handle errors
                e.printStackTrace();
                FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
                FacesContext.getCurrentInstance().addMessage(null, msg);
            return blob;
        }i get this error when clicking the button
    error when not able to download image
    <BeanHandler> <getStructure> Failed to build StructureDefinition for : sms4200.ImageBean
    <UIXEditableValue> <_isBeanValidationAvailable> A Bean Validation provider is not present, therefore bean validation is disabled
    Edited by: Tshifhiwa on 2012/06/03 10:53 AM
    Edited by: Tshifhiwa on 2012/06/03 10:56 AM
    Edited by: Tshifhiwa on 2012/06/03 10:57 AM

    hi i try to run your sample am geting this error
    Error 500--Internal Server Error
    oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/HRDS
         at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1453)
         at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:329)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
         at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:600)
         at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:417)
         at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8972)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4606)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2536)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2346)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3245)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:571)
         at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:234)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:504)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:499)
         at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:517)
         at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:867)
         at oracle.adf.model.binding.DCDataControl.setErrorHandler(DCDataControl.java:487)
         at oracle.jbo.uicli.binding.JUApplication.setErrorHandler(JUApplication.java:261)
         at oracle.adf.model.BindingContext.put(BindingContext.java:1318)
         at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:247)
         at oracle.adf.model.BindingContext.instantiateDataControl(BindingContext.java:1020)
         at oracle.adf.model.dcframe.DataControlFrameImpl.doFindDataControl(DataControlFrameImpl.java:1645)
         at oracle.adf.model.dcframe.DataControlFrameImpl.internalFindDataControl(DataControlFrameImpl.java:1514)
         at oracle.adf.model.dcframe.DataControlFrameImpl.findDataControl(DataControlFrameImpl.java:1474)
         at oracle.adf.model.BindingContext.internalFindDataControl(BindingContext.java:1150)
         at oracle.adf.model.BindingContext.get(BindingContext.java:1103)
         at oracle.adf.model.binding.DCParameter.evaluateValue(DCParameter.java:82)
         at oracle.adf.model.binding.DCParameter.getValue(DCParameter.java:111)
         at oracle.adf.model.binding.DCBindingContainer.getChildByName(DCBindingContainer.java:2748)
         at oracle.adf.model.binding.DCBindingContainer.internalGet(DCBindingContainer.java:2796)
         at oracle.adf.model.binding.DCExecutableBinding.get(DCExecutableBinding.java:115)
         at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:329)
         at oracle.adf.model.binding.DCBindingContainer.evaluateParameterWithElCheck(DCBindingContainer.java:1478)
         at oracle.adf.model.binding.DCBindingContainer.findDataControl(DCBindingContainer.java:1608)
         at oracle.adf.model.binding.DCIteratorBinding.initDataControl(DCIteratorBinding.java:2542)
         at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2477)
         at oracle.adf.model.binding.DCIteratorBinding.getAttributeDefs(DCIteratorBinding.java:3319)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.fetchAttrDefs(JUCtrlValueBinding.java:514)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeDefs(JUCtrlValueBinding.java:465)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeDef(JUCtrlValueBinding.java:541)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeDef(JUCtrlValueBinding.java:531)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding$1JUAttributeDefHintsMap.(JUCtrlValueBinding.java:4104)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeHintsMap(JUCtrlValueBinding.java:4211)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.getHints(JUCtrlValueBinding.java:2564)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2389)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding.internalGet(FacesCtrlAttrsBinding.java:275)
         at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
         at javax.el.MapELResolver.getValue(MapELResolver.java:164)
         at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
         at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
         at com.sun.el.parser.AstValue.getValue(Unknown Source)
         at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)
         at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
         at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:73)
         at oracle.adfinternal.view.faces.renderkit.rich.LabelLayoutRenderer.getLabel(LabelLayoutRenderer.java:929)
         at oracle.adfinternal.view.faces.renderkit.rich.LabelLayoutRenderer.encodeAll(LabelLayoutRenderer.java:213)
         at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.encodeAll(LabeledInputRenderer.java:215)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeFormItem(PanelFormLayoutRenderer.java:1088)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.access$100(PanelFormLayoutRenderer.java:50)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1604)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1523)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:187)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:318)
         at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:283)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeChildren(PanelFormLayoutRenderer.java:420)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.encodeAll(PanelFormLayoutRenderer.java:208)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:447)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$1500(PanelGroupLayoutRenderer.java:30)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:734)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:637)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:187)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:318)
         at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:283)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:360)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:879)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:1294)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeMiddlePanes(PanelStretchLayoutRenderer.java:351)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:316)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:2194)
         at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer.access$400(RegionRenderer.java:50)
         at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer$ChildEncoderCallback.processComponent(RegionRenderer.java:707)
         at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer$ChildEncoderCallback.processComponent(RegionRenderer.java:692)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:187)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:318)
         at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:283)
         at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer._encodeChildren(RegionRenderer.java:297)
         at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer.encodeAll(RegionRenderer.java:186)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at oracle.adf.view.rich.component.fragment.UIXRegion.encodeEnd(UIXRegion.java:323)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:879)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:1294)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeMiddlePanes(PanelStretchLayoutRenderer.java:351)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:316)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:641)
         at oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
         at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:274)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:641)
         at oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
         at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1277)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
         at oracle.adfinternal.view.faces.component.AdfViewRoot.encodeAll(AdfViewRoot.java:91)
         at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
         at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.renderView(ViewDeclarationLanguageFactoryImpl.java:350)
         at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
         at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
         at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:165)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1027)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:334)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:232)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
         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.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:122)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.HRDS' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/HRDS'
         at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
         at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
         at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
         at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
         at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1439)
         ... 190 more
    my connection.xml is
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <References xmlns="http://xmlns.oracle.com/adf/jndi">
    <Reference name="HRDS" className="oracle.jdeveloper.db.adapter.DatabaseProvider" credentialStoreKey="HRDS" xmlns="">
    <Factory className="oracle.jdeveloper.db.adapter.DatabaseProviderFactory"/>
    <RefAddresses>
    <StringRefAddr addrType="sid">
    <Contents>smsdev</Contents>
    </StringRefAddr>
    <StringRefAddr addrType="subtype">
    <Contents>oraJDBC</Contents>
    </StringRefAddr>
    <StringRefAddr addrType="port">
    <Contents>1521</Contents>
    </StringRefAddr>
    <StringRefAddr addrType="hostname">
    <Contents>localhost</Contents>
    </StringRefAddr>
    <StringRefAddr addrType="user">
    <Contents>hr</Contents>
    </StringRefAddr>
    <SecureRefAddr addrType="password"/>
    <StringRefAddr addrType="oraDriverType">
    <Contents>thin</Contents>
    </StringRefAddr>
    </RefAddresses>
    </Reference>
    </References>
    Edited by: Tshifhiwa on 2012/06/04 2:20 PM

  • How to view images from application's path?

    Hello,
    I am using the codes below to view images from an ACCESS database listed as ".\image.png", the images are included in the application's path. I'm able to view the images while running crystal reports alone; However when I include the same report and databse in my VB.NET application, the images don't show. I was told that the report looks for the images in a temp folder, an alternative solution would be to copy the image files to a temp folder before attempting to run the report, but so many things can go wrong with such approach. Do you have a better solution to this problem?
    Thanks in advance.
    Victor
    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim myaop6viewer As New aop6viewer
            Dim myaop6report As New AOP6V2
            Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo
            crConnectionInfo.ServerName = (Application.StartupPath & "\AOP6V2.mdb")
            crConnectionInfo.Password = "testaop"
            setDBLogonForReport(crConnectionInfo, myaop6report)
            myaop6report.RecordSelectionFormula = "isnull({image.country}) = false"
            With myaop6viewer
                .CrystalViewer22.ReportSource = myaop6report
                .Show()
            End With
            myaop6report = Nothing
        End Sub
        Private Sub setDBLogonForReport(ByVal connection As ConnectionInfo, ByVal report As ReportDocument)
            Dim mytables As Tables = report.Database.Tables
            Dim mytable As CrystalDecisions.CrystalReports.Engine.Table
            For Each mytable In mytables
                Dim mytablelogoninfo As TableLogOnInfo = mytable.LogOnInfo
                mytablelogoninfo.ConnectionInfo = connection
                mytable.ApplyLogOnInfo(mytablelogoninfo)
            Next
        End Sub

    I tried following your suggestions, but I'm unable to link to the image file from the application, can you please help me link to the image from the application.
    1. Created a formula name test with the folowing data:
    ".\test.png"
    2. In the Gphics Location, entered:
    {@test}
    3. Below is the code in my application
    Imports System.Data.OleDb
    Imports Microsoft.VisualBasic.ControlChars
    Imports CrystalDecisions.Shared
    Imports CrystalDecisions.CrystalReports.Engine
    Public Class Form1
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim myaop6viewer As New aop6viewer
            Dim myaop6report As New AOP6V2
            Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo
            crConnectionInfo.ServerName = (Application.StartupPath & "\AOP6V2.mdb")
            crConnectionInfo.Password = "testaop"
            setDBLogonForReport(crConnectionInfo, myaop6report)
            myaop6report.DataDefinition.FormulaFields.Item("@test").Text = "path + picture name" '???????
            myaop6report.RecordSelectionFormula = "isnull({image.country}) = false"
            With myaop6viewer
                .CrystalViewer22.ReportSource = myaop6report
                .Show()
            End With
            myaop6report = Nothing
        End Sub
        Private Sub setDBLogonForReport(ByVal connection As ConnectionInfo, ByVal report As ReportDocument)
            Dim mytables As Tables = report.Database.Tables
            Dim mytable As CrystalDecisions.CrystalReports.Engine.Table
            For Each mytable In mytables
                Dim mytablelogoninfo As TableLogOnInfo = mytable.LogOnInfo
                mytablelogoninfo.ConnectionInfo = connection
                mytable.ApplyLogOnInfo(mytablelogoninfo)
            Next
        End Sub
    Thanks,
    Victor

  • Display image from database with jspSmart

    Hi
    I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to display a specific icon in my browser, I get "javax.servlet.ServletException: General error" at:
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    My code looks like this:
    imgModifyDataType.jsp
    <%
    ResultSet myResultSet = null;
    Statement myStatement = null;
    Connection myConnection = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
    String iconName;
    String pDTID = request.getParameter("dtid");
    String mySQL = "Select iconname, icon from data_types where dtid=?";
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    pstmt.setString(1,pDTID);
    myResultSet = pstmt.executeQuery();
    iconName = myResultSet.getString("iconname");
    myUpload.initialize(pageContext);
    myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
    %>
    I call this JSP from another JSP like this:
    <img src="imgModifyDataType.jsp?dtid=<%=pDTID%>">
    If we cannt display image with the help of another jsp like this then please guide me how to modify the imgModifyDataType.jsp to a servlet because I have never worked in servlets.
    Please help
    Sajid

    I think that it may help you get image from database. I used two jsp page. First one is getphoto.jsp that makes as table based in sql statment and invoke the getimage.jsp this last returns images based on
    the getphoto.jsp PhotoId.
    /** getphoto.jsp source code */
    <%@page import="java.sql.*,oracle.jdbc.*"%>
    <html>
    <head>
    <title>
    jsp1
    </title>
    </head>
    <body bgcolor="#ffffff">
    <table width="781" border="2">
    <tr<<td>
    <td width="83" bgcolor="#C0C0C0"><b>PhotoId</b><td width="450" bgcolor="#C0C0C0"><b>Description</b></td><td width="228" bgcolor="#C0C0C0"><b>Photo Image</b></td>
    <%
    Connection conn = null;
    Statement stmt = null;
    ResultSet rset = null;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@itas:1521:oraITAS","yourDbUserId","yourDbPassword");
    stmt = conn.createStatement();
    rset = stmt.executeQuery("select photo_id,photo_description from photo");
    while (rset.next()) {
         %>
         <tr><td width="83"><%=rset.getObject("photo_id")%></td><td width="450"><%=rset.getObject("photo_description")%></td><td width="228"><img src="getimage.jsp?PhotoId=<%=rset.getObject("photo_id")%>" width="238" height="228"></td></tr>
         <%
    conn.close();
    %>
    </table>
    </body>
    </html>
    /** getimage.jsp source code */
    <%@ page contentType="image/jpeg; chaoResult=iso-8859-1" language="java" import="java.sql.*,java.io.*,java.util.*" errorPage="" %>
    <%
    String strConnString = null;
    Connection oDbConn;
    Statement oStmt;
    ResultSet oResult;
    String strConnection = null;
    String strUserId = "c_erober";
    String strUserPwd = "sybdev99";
    String strDatabase = "oraITAS";
    String strPhotoId;
    strConnString = "jdbc:odbc:" + strDatabase;
    String strSql;
    try {
    strPhotoId = (String) request.getParameter("PhotoId");
    strSql = "select photo_image from photo" + ( (strPhotoId==null) ? " where photo_id = '001'": (" where photo_id = '" + strPhotoId + "'") );
    DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
    oDbConn = DriverManager.getConnection(strConnString,strUserId,strUserPwd);
    response.setContentType("image/jpeg");
    oStmt = oDbConn.createStatement();
    oResult = oStmt.executeQuery(strSql);
    oResult.next();
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = oResult.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=getimage.jpeg");
    while((size=sImage.read(bytearray))!= -1 ) {
    response.getOutputStream().write(bytearray,0,size);
    response.flushBuffer();
    sImage.close();
    oDbConn.close();
    } catch (SQLException ex) { ex.getMessage();
    %>

Maybe you are looking for

  • Why do I have to Open and physically Save a provided .xlsx File in order to source it and process it in SSIS?

    It sounds CRAZY...but it's true and I proved it out over many tests... We receive a .xlsx File from an outside vendor. If we simply move the file over to our processing Path and then try to source it and process it in SSIS, we get this error... Excep

  • Pipelined functions from mssql using DG4MSQL

    Hi to All I have made installation of DG4MSQL 11.1 to connect Oracle db 10.2.0.4 to MSSQL server and found this problem. On my MSSQL side there are piplined database objects , functions that behave like tables and which from mssql side is queried by

  • Copying start and end dates from service request contract to tasks

    I am working on a logical apps program that is supposed to go to the service request screens and update the PLANNED_START_DATE and the PLANNED_END_DATE of a task for that service request on file JTF_TASKS_B with the start date and end date of the act

  • I'm having issues down loading adobe flash player

    I've tried to down load the adobe flash player and I'm having issues, I'm doing everything right then this stupid black screen comes up and nothing happens? I need help or please fix this issues Thank You!

  • Connecting problem to I tunes

    For a year almost I have a subscription to iTunes Match. I have always used the same Apple ID Almost 2 weeks now I get an error message saying that I can use iTumes match on this device for 90 days with 1 apple ID. Than I can not use itunes match. It