Showing image stored in database to XML file

Hi
I have an employee portal from where i can take a report of the employee profile .All the details of the employees are in the table.I am storing the image of the employee as BLOB in the table.
How will i show the image file in my XML file.
Thanks in advance.
SRI

The common method to include binary information (image, PDF, document, etc) is to Base64 encode the file and store the resulting character string in the XML. It would be up to the receiving system to handle the encoded information in the XML.

Similar Messages

  • Showing Image Stored In DataBase

    Hello Friends,
    I have images stored in MySQL database. In a blob field. In a desktop application i have used
    blob b=rs.getBlob("Picture");
    byte[] buf=b.getBytes((long)1,(int)b.length());
    ImageIcon imgIcon= new ImageIcon(buf);
    Image img=imgIcon.getImage();
    Graphics g=image.getGraphics();
    g.drawImage(img,0,0,320,240,image);
    the thing worked fine. But now i have to show images over web. I am not able to uderstand that how to show images. As i m unable to get Graphics from any of the component.
    Help Me,
    Its urgent,
    thanking u all
    Abhilash Jain

    The common method to include binary information (image, PDF, document, etc) is to Base64 encode the file and store the resulting character string in the XML. It would be up to the receiving system to handle the encoded information in the XML.

  • Getting image stored in database !!

    Hey !!
    I'm really trying to solve so much problems i'm having with javafx !!
    So, like the title may suggest, i'm having problems as to get image from the database !!
    Everything seems fine but it tells me that there is "Exception while runing Application"
    here is the code !!
    @James D, i will come back bugging yu again to see how to use the stored images and display them inside the combobox and to render them ^^
    I haven't well understand how well as to use the enum struc in which yu declared the composed <Image,String> type ^^
    import java.awt.image.BufferedImage;
    import java.io.ByteArrayInputStream;
    import java.io.InputStream;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javafx.application.Application;
    import javafx.event.Event;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.ComboBox;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    import javax.swing.JOptionPane;
    * @author Minedun6
    public class DynamicCustomComboBox extends Application {
        Connection c = connection.ConnecrDb();
       PreparedStatement pst = null;
       ResultSet rs = null;
       ComboBox box1;
       ImageView view;
        @Override
        public void start(Stage primaryStage) {
            box1 = new ComboBox();
            box1.setPrefSize(100, 25);
            box1.setOnShowing(new EventHandler() {
                @Override
                public void handle(Event t) {
                    box1.getItems().clear();
                    try {
                String sql = "select libelle_constr,img_constructeur from constructeurs where libelle_constr='Citroen';";
                pst = c.prepareStatement(sql);
                rs = pst.executeQuery();
               while(rs.next()){
                   box1.getItems().add(rs.getString("libelle_constr"));
                   InputStream input = new ByteArrayInputStream(rs.getBytes("img_constructeur"));
                   Image imge = new Image(input);
                   view.setImage(imge);
            } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
            StackPane root = new StackPane();
            root.getChildren().addAll(box1);
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setTitle("Hello World!");
            primaryStage.setScene(scene);
            primaryStage.show();
        public static void main(String[] args) {
            launch(args);
    }

    In any real application, it's a mistake to mix your presentation (user interface) code with your persistance (database access) code.
    Why? You want maintainability, flexibility, and testability.
    Maintainability:
    Suppose you want to change the structure of your database. E.g. the database admin (which may be you, or someone else) determines that the database design you have is inefficient and needs to be changed. If your database code is scattered over the whole application, mixed in among your user interface code, tracking down what needs to be changed will be a nightmare. If all your database code is in a single class, or perhaps a set of classes in a single package, then the updates are localized and much easier to manage. Furthermore, you can build the new database access code on its own, test it out, and then when you are sure it works just switch your user interface code to use the new persistance layer instead of the old one. The same applies if you decide you're going to use a completely different technology to store the data; perhaps you want to use something like Hibernate instead of plain JDBC, or maybe you decide you want to make the data accessibile via a web service.
    Flexibility:
    What if you (or, more likely, your manager) decides they're going to change to a new user interface technology. Maybe they decide to switch to a web application (i.e. HTML-based) instead of a desktop application. You obviously need to rewrite the user interface code, but you should be able to keep all the database access code you've written. If your database access code is all jumbled up with the user interface code you're replacing, it's going to be way harder to reuse that code. If the two are separated out, you just build a new user interface in whatever new technology you're using, and access the same class(es) you used for your database access without touching them.
    Testability:
    This whole thread is actually a demo of how testability is much harder if you don't properly separate your code. You posted "getting image stored in database", thinking that was your problem. It wasn't; your problem was actually an error in the way you'd set up your JavaFX code. Because the two were completely mixed together, it was hard to know where the error was. The error you had was actually a really simple one; it would have been much easier to see if you had simpler, properly separated code; but because you didn't organize your code like that it took you days to figure out the problem. This was only a couple of dozen lines of code; imagine how this looks in a real application with hundreds or thousands of classes.
    The point is that decisions about how to access your data (standalone database, web service, or EJB?; plain JDBC, JPA, Hibernate, etc?) , and decisions about the presentation technology (desktop or web? JavaFX or Swing?, or Servlets/JSPs, JSF, Swing MVC, or any of a huge number of frameworks) are completely independent. You should be in a position to change those decisions - to redesign aspects of the application - with the least amount of effort possible. Failing to properly design things will make this much harder, or likely completely impossible.
    These are real concerns that affect every application that goes into production.
    Even if you're just making a small application, it will benefit you to set things up correctly from the outset.

  • Show images stored in DB in browser

    Is is mandatory to use intermidia for showing images stored in DB?
    I mean,is it possible to use just PL/SQL to show images uploaded to Oracle 8i. If so, how? Does anyone could send me a sample code?
    Thanks in advance and best regards.

    I have Oracle 8.1.5 and I read that interMedia license is included in DB license.
    In this case I am free to use interMedia.
    Does interMedia comes with 8.1.5 also?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by ymizuno():
    You can store images as Blobs in the database, without using interMedia. However, if you store images as OrdImage using interMedia with attributes, you can get many advantages of it. interMedia comes with the Oracle database if you have Oracle 8.1.6. Are there any particular reasons why you do not want to use interMedia? <HR></BLOCKQUOTE>
    null

  • XML stream and stored as an output XML file

    Dear ALL,
    Could you help me in such situation?
    I need create XML file. I have DTD file. I create XML stream and stored as an output XML file. But all the data of my XML file stored in one line.
    How I can create my XML file according to DTD file?
    Thanks a lot.
    Best regards,
    Igor

    hi
    good
    go through this links,hope these would help you to solve your problem
    http://rustemsoft.com/JSPsample.htm
    http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.etools.xmlbuilder.doc/tasks/txmltask.htm
    thanks
    mrutyun^

  • Displaying Images stored in Database

    Hi, all i am having images stored in Databases as BLOB.
    how i can display that in flex application. suppose i am having the ArrayList of Employees in which employee object also have a field of called empImage, how i can display this data in flex.
    i am using BlazeDS.
    Thanks
    Regards
    Amar Deep Singh

    Hi,
    This will give you the idea of getting the image from you array list.
    http://blog.flexexamples.com/2008/02/15/creating-a-simple-image-gallery-with-the-flex-hori zontallist-control/
    Johnny
    Please rate my answer. Tks

  • Create XML stream and stored as an output XML file

    Dear ALL,
    Could you help me in such situation?
    I need create XML file. I have DTD file. I create XML stream and stored as an output XML file. But all the data of my XML file stored in one line.
    How I can create my XML file according to DTD file?
    Thanks a lot.
    Best regards,
    Igor

    hi
    good
    go through this links,hope these would help you to solve your problem
    http://rustemsoft.com/JSPsample.htm
    http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.etools.xmlbuilder.doc/tasks/txmltask.htm
    thanks
    mrutyun^

  • Update Database Through XML file using SAP B1 business objects

    Hello everyone,
    I am facing a problem ie I am not able to update the Database(SQL 2000) through an XML file.
    Though i am able to insert the data in the databse using xml file but unable to update that data.
    The tables i want to update are OITM,ITM1,OITW. While i was trying to update  the Databse i was getting an error ie " -1107 Object's key is not set".
    I dont want to use DTW for importing or anything.
    Kindly help me out why i am facing this problem asap...

    Hi Pranay,
    My case was that I wanted to replicate an item from one company to another (I guess that's your case also). What I finally did is copy field by field the objects I needed. Later I've find out the solution given here,
    Copy items between databases
    but I haven't try it out. I expect your comments about it :).
    Regards,
    Ian

  • Issue to load data from database to XML file. error: ODI-40768

    Hi,
    While I am trying to load data from database to XML following error is appearing.
    ODI-1228: Task TEST_XML_DATA (Integration) fails on the target XML connection MyLOCALXSD.
    Caused By: java.sql.SQLException: ODI-40768: Could not save the file <default>:C:\DATA_FILE\www.xml because a class java.io.IOException occurred and said: The filename, directory name, or volume label syntax is incorrect
         at com.sunopsis.jdbc.driver.xml.SnpsXmlFile.writeToFile(SnpsXmlFile.java:751)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.internalExecute(SnpsXmlConnection.java:769)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlPreparedStatement.execute(SnpsXmlPreparedStatement.java:46)
         at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:166)
         at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
         at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         at java.lang.Thread.run(Thread.java:662)
    jdbc url: jdbc:snps:xml?d=C:\test_xsd.xsd&s=TESTSQL&re=employeesX&ro=true
    physical schema: TESTSQL
    Knowledge modules are:
    LKM: LKM SQL to SQL
    IKM: IKM XML Control Append
    CKM: CKM SQL
    Parameters set are:
    CREATE_XML_FILE: true
    XML_PATH:<default>:C:\DATA_FILE\www.xml
    I have tried to change the directory path but error is still there.
    Could some one please help me to resolve the issue?
    Regards,
    user1672911

    Hi,
    The trouble in "<default>:"  - if you set XML_PATH as C:\DATA_FILE\www.xml instead  <default>:C:\DATA_FILE\www.xml- it will work correctly.
    Greetings,
    Eugene

  • Pdf printing of an image stored in database?

    Hi,
    I am using pdf printing option, but stuck in a case where I need to retrieve a image from the database table stored as a blob content.
    Is it possible to create a report review of this sort?
    Is this even possible?
    Thanks..

    Hello,
    Yes, absolutely.
    Check out this blog post by Marc Sewtz on how to do it -
    http://marcsewtz.blogspot.com/2008/06/one-question-about-pdf-printing-feature.html
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Centre aligning images within picture frame using XML file

    Hi
    I am using a flash file that uses an xml file to upload a
    series of images one at a time into a picture holder.
    There are two different widths of the images. The height is
    always the same. Is it possible to set this up so every image that
    the xml file calls is centre aligned within the picture frame.
    At the moment when using the xml file to load the image it
    always left aligns the image when it brings it into the picture
    frame even if you change the alignment to centre align within in
    the align panel.
    Does anyone have a suggestion why this is happening or how to
    fix it?
    Thanks for the help

    You're welcome. Pleased it worked.
    All it does is use the MovieClipLoader class to load the
    images into your holder_mc. Because loading takes time, and because
    you can't check or adjust the size or position of images until they
    have loaded, the MovieClipLoader class gives you a handy option to
    run some code whenever its finished loading something you told it
    to load.
    That's what the addListener instruction does... it says
    whenever myLoader has something new to tell me about the status of
    the load requests I ask it to do... make it run some related code
    in the listener object (which is called loadListener in this
    code... it could equally be called something else). You 'listen'
    for different events or updates of status. All I 'listened' for
    here was the onLoadInit event.
    The onLoadInit is the 'final' status update after loading. It
    occurs when something has loaded and its properties are accessible
    (_x, _width etc). The target_mc that is an argument for the
    loadListener.onLoadInit is a reference to the clip that was loaded
    into.
    The best way to learn about this stuff is probably to read up
    on MovieClipLoader in the livedocs and try google to see if there's
    an online tutorial somewhere. Then give it a try yourself in
    another new fla.
    cheers
    GWD

  • How to write from database to XML file using JAVA and back..

    Hi....
    I am strugling for a code to write from database to xml output instead of what i have written in flat file....could anyone please help me out...to do this and again read the same back to the database using java...

    Hi,
    In java world, there is a tutorial on what you are looking for :
    http://www.javaworld.com/javaworld/jw-01-2000/jw-01-dbxml_p.html
    It uses SAX/DOM parsers to translate XML data into the appropriate fields of the database and visa-versa.
    Hope it helps.

  • Updating Oracle 8.1.6 database with XML file

    Hi All,
    I need your help for the following scenario.
    I'll transfer data from 13 tables of SQL Server 6.5, into a XML
    file. That file might contain around 70 Lakhs records(rows).
    This 70 lakh records will be shared by 11 tables in Oracle 8.1.6
    database. So each table would approximately have around 6.5 lakh
    record each. How to transfer this XML file data into those 11
    tables? Is any tool available to do so?
    And before inserting that 6.5 lakh rows into a table, i need to
    clear up that table (means delete all the existing data). In
    this case, if the XML data tranfser fails, i need to rollback
    the deleted old data. I want to know about rolling back
    volumness deleted rows.
    Need your solutions on this.
    Thanx in advance.
    Rgds
    Elav.

    Hi All,
    I need your help for the following scenario.
    I'll transfer data from 13 tables of SQL Server 6.5, into a XML
    file. That file might contain around 70 Lakhs records(rows).
    This 70 lakh records will be shared by 11 tables in Oracle 8.1.6
    database. So each table would approximately have around 6.5 lakh
    record each. How to transfer this XML file data into those 11
    tables? Is any tool available to do so? SQL*Loader or XSU. Question: Why you are trying to use XML file
    instead of using plain data file?
    >
    And before inserting that 6.5 lakh rows into a table, i need to
    clear up that table (means delete all the existing data). In
    this case, if the XML data tranfser fails, i need to rollback
    the deleted old data. I want to know about rolling back
    volumness deleted rows.
    Using SQL*Loader you can specify to clean up the old data before
    insertion, but not sure about the rolling back to the deleted
    rows after insertion failure.
    You can write a small application based on XSU to finish this
    task. But note about the commit size. If you data volumn is
    large, you need to set the commit size > data. Also you probably
    need to divide the data into small pieces so as to avoid running
    out of redo log.
    Need your solutions on this.
    Thanx in advance.
    Rgds
    Elav.

  • Storing internal table from XML File into DDIC

    Hi everybody,
    im trying to store an internal table <b>without</b> knowing the content - means the structure (fields)- into th DDIC, but i failed. The code is:
    DATA xslt_error TYPE REF TO cx_xslt_exception.
    TRY .
    perform load_file  using 'D:/usr/YTGVF_asXML.xml'    changing itab_XMLResult.
          refresh itab_tableA.
          call transformation id
            source xml itab_XMLResult
            result GREATEST = itab_tableA.
    CATCH cx_xslt_exception INTO xslt_error.
      DATA: xslt_message type string .
      xslt_message = xslt_error->get_text( ).
      write xslt_message.
    ENDTRY.
    form load_file
      using    path type localfile
      changing tab type table.
      data:    s type string,
               filelength type i.
      s = path.
      refresh tab.
      call function 'GUI_UPLOAD'
        exporting  filename   = s
                   filetype   = 'BIN'
        importing  filelength = filelength
        tables     data_tab   = tab
        exceptions others     = 1.
    endform.                    "load_file
    So, how can i store itab_tableA, without knowing the content (fields) of the table? The XML-File is of type asXML - i guess there should be a solution.
    Thanks for all replies!
    BG, Jim

    Absolutely, I don't see why that would be a problem.
    After parsing through the schema or DTD, you would know what the structure of the XML file coming through would be. So it would be basically uploading the file to SAP and then parsing the schema or DTD file, you will come to know the structure of your XML.
    And once you know the structure, you can create your <a href="/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table internal table</a>, and put the values from the XML file in the same.
    Considering my limited knowledge in XML, I am not able to provide information regarding , if there are any function modules/classes which SAP supports to directly read an XML schema/DTD and create a table of that sort. But the above inputs should help you in your way...
    Regards,
    Subramanian V.

  • Serving webpage with image stored in database

    This may look long, but it's easy to understand--I'm just trying to give all the details you might want: In our servlet/JSP site, a user can generate a report that may or may not contain images. The servlet just sends the user to a regular HTML page. The HTML file and images it may have are stored in directories on the Tomcat server. But now we have a problem...
    We're moving to 2 standalone Tomcat machines with a load balancer in front, and so now we want to move any of this stuff that was stored on the webserver into the database. If the HTML text for the report has not yet been generated for that day, I can see my web app going to the database to pull out that HTML, and if there are any images, it could pull those out of the database, but then...how does it get those to the user's web browser?
    Currently, when this report loads in the browser, we do a sendRedirect to the file, and the URL displays the full path to the file (and in the HTML code, there is of course a relative link to the image file). But now, these are supposed to be pulled out of the database...are we going to have to pull them out of the database and then write them out to file on the webserver (since they might not exist on that webserver), or is there some other/better way to display them to the user?
    Thanks...

    You can create an Image Servlet that you use to stream the image streight from the db to the page. The URLs that you use in the HTML pages would point to this Servlet with a parameter identifying the image (or you could map the Servlet to *.gif for example). The servlet then sets the content type to the appropriate image format, retrieves the image from the DB as a Stream and copies it byte for byte to the response output stream.
    If you search the forums you will probably find an example of how to do this.

Maybe you are looking for

  • What is Short Dump Analysis and  secendry index  ?

    Dear Experts . 1.) What is purpose of T-codes SE30 and ST22 ? What is Short Dump Analysis ? 2.) What is secendry index , How to use it ? How it effects the Performance of a report ? Please it is urgent ... Regards : Rajneesh

  • My iMac will not load since a power flux

    Today there was a power flux as i was using my iMac. I did not try to turn it on for 2-3hrs after the iMac screen went black as it turned off due to lack of power. Later i did try to turn the computer on twice, after unplugging it in. Each time I did

  • ITunes want me to remove all of my data

    I had gotten a ringtone maker app because I dont want to pay for the ringtones Apple has. I had made the ringtone and pluged my phone in to my computer, but when I want to "Sync Tunes",  it says, "Are you sure you want to remove existing music, movie

  • How do I switch through the English and Spanish keyboards on my ipod touch while I am typing instead of stopping and going into settings?

    I went into settings and added the Spanish keyboard on to my ipod touch. But here's the thing. If I have the keyboard in English, while I am typing I can't use any Spanish because it wants to correct all my words and turn them into English words, and

  • Is my approach to this problem correct?

    Hi, I'm new to Java and OO programming, and this is my first coding experience in Java, so, be patient...! I'd like to know if the approach I'm adopting for the following exercise is acceptable. Hints and critics on how could I improve it are the rea