Storing Images in Database using ADF/UIX

Hello,
Please let me know of any exmaples or tutorials on how to use Oracle Intermedia to store Images in Database and retrieve the images and display them on UIX.
I tried using declarative approach of using ADF input form for the table which contains a blob column.
In the entity object, i changed the blob column type to OrDImageDomain. I changed the Form settings to POST and UsesFileUpload attribute to True.
I got an error "Incompatible Types" when trying to insert a row in the database table.
Please provide suggestions/comments
Thanks a lot.

Now I'm using OrdFileUploadManager and i'm getting an error message as,
VB_Pbefore (The system cannot find the file specified. )
Pbefore is the attribute name of the view object.
The form that i'm using to insert the row in the database is,
<labeledFieldLayout>
<contents>
<messageChoice model="${bindings.Pid1}">
<contents childData="${bindings.Pid1.displayData}">
<option model="${uix.current}"/>
</contents>
</messageChoice>
<messageChoice model="${bindings.Rno1}">
<contents childData="${bindings.Rno1.displayData}">
<option model="${uix.current}"/>
</contents>
</messageChoice>
<messageFileUpload model="${bindings.Pbefore}">
<end>
<media model="${ctrl:createMediaModel(bindings.Pbefore,'ReoAppModuleLocal')}"/>
</end>
</messageFileUpload>
<messageFileUpload model="${bindings.Pafter}">
<end>
<media model="${ctrl:createMediaModel(bindings.Pafter,'ReoAppModuleLocal')}"/>
</end>
</messageFileUpload>
<messageStyledText/>
<submitButton text="Submit"/>
<submitButton text="Confirm Repair Photos" model="${bindings.Commit}" id="Commit2" event="action"/>
</contents>
</labeledFieldLayout>

Similar Messages

  • Uploading xml file using ADF UIX and storing in ordsys.orddoc field

    I am using ADF UIX and I am using the messageFileUpload tag to upload an XML file into the database (the file contains special characters like hyphens, apostrophes, $, etc). Once in the database I have a procedure which puts it into a clob field using the dbms_lob package. However, what exactly does ordsys.orddoc do with special characters? If I debug my procedure I see that 1 of 4 hyphens and 3 apostrophes have been turned into a character that looks like a square. Anyone know what is going on?

    It should pass binary information only, no conversion at all.
    The conversion is likely in messageFileUpload or the dbms_lob package you are using. Or you may need to tell DBMS_LOB the character set the XML file is in?
    You may want to upload the file using the interMedia tag library... Using uploadFormData?
    http://www.oracle.com/technology/software/products/intermedia/htdocs/descriptions/tag_library.html
    http://www.oracle.com/technology/products/intermedia/htdocs/jsptaglib/html/toc.htm
    Larry

  • File upload, download using ADF UIX and not JSP

    I have examples for the file upload, download using JSP
    But I want to use ADF UIX. Look and feel in this is impressing and I want to use this. Any one have example for this.
    Users will select a file from their desktop
    This will be stored into the database (Any document. Word, Excel)
    When they query the records then the UIX column need to give a hyperlink. Clicking on the link should prompt to download the file to the local system

    Sure, I use the Apache Commons File Upload package, so that is what I will discuss here ( [Commons File Upload|http://commons.apache.org/fileupload/] ).
    The Commons File Upload uses instances of ProgressListener to receive upload progress status. So first create a simple class that implements ProgressListener:
    public class ProgressListenerImpl implements ProgressListener {
        private int percent = 0;
        public int getPercentComplete() {
            return percent;
        public void update(long pBytesRead, long pContentLength, int pItems) {
            if (pContentLength > -1) { //content length is known;
                percent = (new Long((pBytesRead / pContentLength) * 100)).intValue();
    }So in your Servlet that handles file upload you will need to create an instance of this ProgressListenerImpl, register it as a listener and store it in the session:
    ServletFileUpload upload = new ServletFileUpload();
    ProgressListenerImpl listener = new ProgressListenerImpl();
    upload.setProgressListener(listener);
    request.getSession().setAttribute("ProgressListener", listener);
    ...Now create another servlet that will retrieve the ProgressListenerImpl, get the percent complete and write it back (how you actually write it back is up to you, could be text, an XML file, a JSON object, up to you):
    ProgressListenerImpl listener = (ProgressListenerImpl) request.getSession().getAttribute("ProgressListener");
    response.getWriter().println("" + listener.getPercentComplete());
    ...Then your XMLHttpRequest object will call this second servlet and read the string returned as the percent complete.
    HTH

  • How to store images in database using java

    hii
    how to store images in database using java..........
    Message was edited by:
    naveennaga

    I asked a similar question once and the answer I got was - Don't.
    Instead, store the images on a drive somewhere and store the path in the database.
    But I'm no expert - that's just what I was told by someone who does this kind of stuff a lot.
    Hope that helps.

  • Unable to create Entity objects for tables in TimesTen database using ADF

    Hi,
    I am not able to create Entity and View objects for tables in TimesTen database using ADF. I have installed TimesTen client on my machine.
    I have created a database connection by using connection type as "Generic JDBC" and giving driver class and JDBC URL. I am attaching screen shot of the same.
    I am right clicking on Model project and selecting New option after that I am selecting ADF Business components and in it I am selecting Business components from tables and there I am querying for tables.I am getting list of tables and when I am trying to create a Entity object from the table after clicking finish Jdev is closing by itself giving an error.
    Can anyone please help me how to create Entity objects for tables using TimesTen as database.I might be missing some jars or the way I am creating connection might be wrong or any plugins required to connect to TimesTen.

    What is the actual error being given by Jdev? Are you sure that the JDBC connection is using the TimesTen JDBC driver JAR and not some other JDBC driver or the Generic JDBC/ODBC bridge?
    Is ADF even supported with TimesTen?
    Chris

  • Insertingand retrieving images in database using jdbc

    i am new to jsp.i have to store and retrieve image files using oracle 8i.Then i have to display it using jsp.
    my code for storing image is
    package sample;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    import java.sql.*;
    import java.io.*;
    import java.awt.image.*;
    import java.awt.*;
    public class storephoto{
    public static void main(String[] args){
    String filename = "C:/Documents and Settings/user/Desktop/five.gif";
    Connection conn = null;
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn=DriverManager.getConnection("jdbc:oracle:thin:@10.1.4.228:1521:data","system","manager");
    conn.setAutoCommit(false);
    Statement st = conn.createStatement();
    int b= st.executeUpdate("insert into bfiles values('"+filename+"', empty_blob())");
    ResultSet rs= st.executeQuery("select * from bfiles for update");
    rs.next();
    BLOB blob=((oracle.jdbc.driver.OracleResultSet)rs).getBLOB(2);
    FileInputStream instream = new FileInputStream(filename);
    System.out.println("instream="+instream);
    OutputStream outstream = blob.getBinaryOutputStream();
    System.out.println("outstream="+outstream);
    int chunk = blob.getChunkSize();
    System.out.println("chunk="+chunk);
    byte[] buff = new byte[chunk];
    int le;
    while( (le=instream.read(buff)) !=-1)
    System.out.println(le);
    outstream.write(buff,0,le);
    System.out.println(buff);
    instream.close();
    outstream.close();
    conn.commit();
    conn.close();
    conn = null;
    System.out.println("Inserted.....");
    catch(Exception e){
    System.out.println("exception"+e.getMessage());
    e.printStackTrace();
    }//catch
    This code works fine & something gets stored in the buffer.but while rereiving nothing gets retreived.i cannot retrieve the image file
    my code for retreiving is
    package sample;
    import java.sql.*;
    import java.io.*;
    import java.awt.*;
    import oracle.sql.BLOB;
    public class retphoto
    public static void main(String a[])
    String fileName ="C:/Documents and Settings/user/Desktop/five.gif";
    try
    Driver driver = new oracle.jdbc.driver.OracleDriver();
    DriverManager.registerDriver(driver);
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@10.1.4.228:1521:data", "system", "manager");
    File file = new File("C:/Documents and Settings/user/Desktop/sa1.gif");
    FileOutputStream targetFile= new FileOutputStream(file); // define the output stream
    PreparedStatement pstmt = con.prepareStatement("select filecontent from bfiles where filename= ?");
    pstmt.setString(1, fileName);
    ResultSet rs1 = pstmt.executeQuery();
    rs1.next();
    InputStream is = rs1.getBinaryStream(1);
    System.out.println(is);
    byte[] buff = new byte[1024];
    int i = 0;
    while ((i = is.read(buff)) != -1) {
    System.out.println("hai");
    System.out.println(i);
    targetFile.write(buff, 0, i);
    System.out.println("Completed...");
    rs1.close();
    is.close();
    targetFile.close();
    pstmt.close();
    con.close();
    catch(Exception e)
    System.out.println(e);
    }

    Thanks for ur help:
    another Q:
    in my GUI i have a button called Insert. but can't update my database table unless i create textField(e.g Firstname, Surname..ect..), so that when I click Insert button in actionEvent it will bring up popup which have field name in which i am going to insert new records.
    so what iam trying to say is, how iam going to tell the actionEvent to trigger this.
    the following is my code
    public void actionPerformed(ActionEvent event)
    ExamResults exam= new ExamResults ();      
    String studentId = studentTextField.getText();
    if (event.getSource() == insert) //if insert is clicked
    Thanks

  • Store and retrieve image in database using WD Java

    Hi All,
    I have to store and retrieve an image in oracle database. I have gone through the below blog and forum...
    How to display an image, which is stored in a database?
    The specified item was not found.
    I am able to store image in byte format(oracle data type BLOB) and when i try to retrieve it i am not getting the image....Sorry for my poor technical knowledge.
    can some body help me, please......
    Regards,
    G.

    Hi,
    my code is working... I am able to upload and retrieve the image. But now I am getting the below exception...
    Exception from image insert>> java.sql.SQLException: Data size bigger than max size for this type: 6770
    Below is the code I am uing...
    ConnectDataBase condb=new ConnectDataBase();
        IWDMessageManager mgnr=wdComponentAPI.getMessageManager();
         IPrivateDBImageView.IVn_FileElement  fileelement =
                                  wdContext.nodeVn_File().getVn_FileElementAt(0);
                             IWDResource resource=wdContext.currentContextElement().getResource();
    InputStream in=resource.read(false);
    ByteArrayOutputStream bOut=new ByteArrayOutputStream();
                             int lenght=0;
                             byte part[]=new byte [ 50000 ];
                             while((lenght=in.read(part))!=-1)
                             bOut.write(part,0,lenght);     
              Statement  stmnt=null;
                   Connection con=null;
                   String strQuery=null;
                   String strProp_Details=null;
                   try {
                        con=condb.getConnection (mgnr);
                        stmnt=con.createStatement();
                   PreparedStatement pst=con.prepareStatement("insert into VMS_Image values(?,?,?)");
                        pst.setInt(1,4);
                        pst.setString(2,"srinu1234");
                        pst.setBytes(3,bOut.toByteArray());
                        pst.execute();
                        bOut.close();
                        in.close();
                        mgnr.reportSuccess("Inserted");
                   catch (SQLException e) {
         mgnr.reportException("SQLException from image insert>>"+e,false);
                   catch(Exception e)
                             mgnr.reportException("Exception from image insert>>"+e,false);     
                        finally
                        try
                        if(stmnt!=null)
                             stmnt.close();
                             stmnt=null;     
                        if(con!=null)
                             con.close();     
                             con=null;
                        catch(Exception e)
                             mgnr.reportException("Exception in Closing from image insert>>"+e,false);
    first I used byte of 101024, then 501024 and finally tried with byte of 50000. I am getting the above exception if the image size is more than 4kb....
    Regards,
    Srinivas.
    Edited by: srinivas sistu on Aug 1, 2008 2:26 PM
    Edited by: srinivas sistu on Aug 1, 2008 2:34 PM

  • 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

  • Storing images in database

    want to store images in database for security. I c an't remember the steps to take advantae of the security feature in the DAD section of the em tool

    I suggest that you convert the Images to jpg (or png or another format that is understood by a browser). Depending on the creation/read ration (normaly you create an image that is read several times), I suggest doing the convertion before storing it in the database
    // BufferedImage bi is created before...
    // out is your OutputStream to the Blob-field
    com.sun.image.codec.jpeg.JPEGImageEncoder encoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder(out) ;
    // get the EncodingParameters
    com.sun.image.codec.jpeg.JPEGEncodeParam jep = encoder.getDefaultJPEGEncodeParam(bi) ;
    jep.setQuality(compress,true) ;
    encoder.setJPEGEncodeParam(jep) ;
    encoder.encode(bi) ;
    // System.out.println("Fertig codiert") ;
    // flush the OutputStream and close it
    out.flush() ;
    out.close() ;you should have an unique identifier for each image, that is kept in the key column(s) of your image table.
    To retrieve the image write a servlet, to which you pass this unique key as a parameter (or several if it is a multi column key) . This servlet should than access the database, select the row, open the Blob field and read it and write the bytes to an OutputStream you get from the response argument of doGet or doPost.
    If you expect large images, you can stream the result, i.e. not read it in fully before writing it to the output stream but rather write each chunk you read to the output stream immediately.

  • 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

  • How to display image in database using php

    i've try search all hope that you all can give me some guidance how to display data that is in image or BLOB using PHP. just a query and php code that will make display of the image. hope that you all show me the example or give me reference that i need to solve my problem.

    Hi,
    Have a check on these Google results, you might find something there...
    http://www.google.com/search?sourceid=navclient-ff&ie=UTF-8&q=%22display%20image%22%2Boracle%20%2Bphp

  • How to display Images stored in a database using javascript

    Hi.
    I have some images stored in a table and I need to display them using javascript. The images are stored in BLOB columns: I would like to know if I can put them on a directory and then get it from there using BFILENAME function.
    Any suggestion?
    Regards,
    Jeannine

    Hi All,
    Yes DuraiRaja - i am using the document.getElementById(' ').
    In my app, I have a Main controller calling a View - Default.HTM,
    This Default.HTM, in turn loads up three trays T1, T2, T3 and these tray elements in turn call up the controllers ctrl1, ctrl2, ctrl3 associated to them.
    CTRL1 calls a view - View1 - V1.htm, which has the below code.
    And on the below page all that i am trying to do is validate if "FieldVal" is blank or not.
    I get an error on IE as "Object required"
    I get a HTTP 501/505 error when i try to upload the code.
    Thanks all !

  • How to display image in database using html or php

    i've try already to work this thing but i can't do it. anyone that can help me or give me any example or reference to resolve my problem to retrieve or display image(blob) from database. hope that all of you help me

    Using JHeadstart, you can display a BLOB column from the database in HTML, by way of ADF. Check out the JHeadstart Tutorial at http://www.oracle.com/technology/products/jdev/tips/muench/jhstutorial/index.html to get started, then do the same for your own database tables that include the BLOB column. JHeadstart will take care of rendering it as a file upload or image, depending on the display type you set at the attribute level.
    Hope this helps,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting

  • Uploading images into database using webforms...

    Hi,
    I'm trying to upload images in to the database. This is possible on a normal form running the forms runtime, but how do i do it when is comes to webforms?
    Thanx in advance!

    hai roshapt
    what is the fine extension u r using.to get the images to disply in web also place the image file in the same path where u place the
    .fmx forms or create a virtual directory for images and configure that virtual directory also.
    regards
    ramesh.

  • Calling a Stored Procedure From Database Using XI.

    Hi,
    Please help in writing a UDF for these fields in mapping, which I need for the object Iu2019m doing currently.
    The fields are like this:
    1) batch_no = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/5000)+1",
    2) lot_id = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/500)+1",
    3) How to use JDBC connection factory class in the UDF.
    Some logic I can provide which I know i.e. Power (2, 28) means 2 to the power of 28 (2 multiplied 28 times), Trunc means truncate, X_TXN_SAP_Parts is a database table.The Target fields are Batch_no, lot_id & Objid.Actually, objid is mapped initially to a source field i.e. Object ID and in this function it is only being used for the calculation of the batch_no.
    I've tried to use this code but still I'm unable to execute the mapping.
    import java.util.*;
    import com.sap.aii.mapping.lookup.*;
    import com.sap.aii.mapping.lookup.*;
    DataBaseAccessor accessor = null;
    DataBaseResult JDBCOutPayload = null;
    String BusinessSystem="clarify_dev_bizsys";
    //give your business system having channel name
    String CommunicationChannel="JDBC_TO_CDEV";
    //give your channel name
    String InputPayload= " select X_TXN_PRE_SITE_XFACE.nextval from dual;";
    //give your sql query
    try {
    Channel channel =
    LookupService.getChannel(BusinessSystem,CommunicationChannel);
    accessor = LookupService.getDataBaseAccessor(channel);
    DataBaseResult resultSet = accessor.execute(InputPayload);
    for(Iterator rows = resultSet.getRows();rows.hasNext();){
    Map rowMap = (Map)rows.next();
    Object cValue = rowMap.get("batchno");
    //field name of field required , as in database
    catch (Exception e) {}
    finally {
    if (accessor != null)
    accessor.close();
    result.addValue((String)cValue);
    --> I don't know what are the parameters to be used and how to be used in the UDF because this is the first time I'm writing a UDF.
    --> The problem in using this query is that both OBJID & BatchNo. are on the target side and the value for the OBJID is retrieved by a SELECT query from the database.
    Kindly help me how to resolve this query of mine.
    Thanks in Advance.
    Sreedhar.

    Hi,
    The scenario is like I've to get a field (OBJID) value after using a SELECT statement from the database and use the same value for calculating another field values which is BATCHNO & LOTID.
    OBJID, BATCHNO and LOTID are from the same database.
    Thats all I was provided as the input.
    Do let me know if you need anymore information. I'll try to give as much input to the extent I know.
    Sreedhar.

Maybe you are looking for