JCo - retrieving images (Urgent)

Hi,
I have to retrieve an image from SAP and render it in the portal. I get the data via Jco as a table and from the table I retrieve a binary stream. When I write the stream to a file the image doesn't display. Funny thing is, if I take the same image that is in SAP and read it from a file, the input stream data seems completely different from the data I get from SAP. Is something happening in the background that I am not aware of? Any help or ideas would be greatly appreciated

We had also problems with a PDF-file from R/3. The reason was that line feed etc where missing in the PDF-Datastream.
Do You get the data line by line in a JCO.Table?
Walter

Similar Messages

  • Urgent : store and retrieve image to oracle database thru applet

    hi all
    i want the code sample for storing the image to oracle database
    development enviornment:
    server : oracle 9i , apache web server
    client : ie6 browser
    i am connecting to oracle database thru applet using oracle jdbc thin driver
    can anyone give me details about storing image to db
    1) what datatype should be used in table for image?
    2) my image files are on client machine... can i directly read those files from browser or first i have to copy those files to server?
    3) .gif files will do or what should be the fileformat?
    4) java code to store it to database (i am using jdk1.3)
    5) how to retrieve it back from database and display it in awt panel ?
    its very urgent ...
    i am doing some r&d and trying to do using blob....
    but it will take some time ...
    i will really be thankful if someone sends detail code....
    thankx in advance ....

    Hi,
    The code below might answer few of your questions.
    There is a restrcition on size of image, it must be less than 4KB.
    //Code to insert image in database
    //mytable is the table name that contains two fields in databse:name,image of type varchar and blob
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con =null ;
    Statement stmt =null ;
    con =DriverManager.getConnection  ("jdbc:oracle:thin:@<hostname>:1521:orclsid", "system","manager");
    PreparedStatement preparedStatement = con.prepareStatement("insert into mytable (name,image) values (?,?)");
    preparedStatement.setString(1,"Amol");
    InputStream inputStream = new BufferedInputStream(new FileInputStream("C:\\WINNT\\Temp\\netscape\\images\\menubg.jpg"));
    preparedStatement.setBinaryStream(2, inputStream, inputStream.available());
    preparedStatement.executeUpdate();
    preparedStatement.close();
    inputStream.close(); To retrieve image,here is the snippet
    ResultSet resultSet = stmt.executeQuery("select image from mytable'");
    if (resultSet.next())
    byte[] image1 = resultSet.getBytes("image");
    FileOutputStream fos=new FileOutputStream("c://splash11.jpg"); //will retrieve bytes and create a file
    //by the name specified
    fos.write(image1);
    -Amol

  • How to retrieve image from a document

    Hi
    I am a beginner to Adobe InDesign SDK (CS4) and was needing some help. Here is the sceneario
    I have a simple InDesign document with an image in it. I am trying to retrieve the image and do some proprietory actions on it.
    I am wondering if there is an InDesign API which can retrieve image on a document. What is the return value from such an API. (e.g does the API return a pointer to the image object or maybe  location of the image on the filesystem ? ). What I am trying to do is once I can get a "handle" to the returned image, I would like to  manipulate it and save it in a proprietory format.
    Any pointers on this would be highly appreciated
    thanks!
    Sam

    Hi,
    You can get the path of the linked image file and then you can manipulate this image.
    I think ILinkUtils and ILink will certainly help.
    You can also check (for better understanding) CHM->PortingGuide->Links Archtecture.
    Thanks.

  • Retrieving images for a java game

    i am currently trying to make a game whereby i have to retrieve images from a file and display it to the screen. I am able to do this using applets but the game i am implementing does not use applets - it only makes use of awt and swing components. any advice given would be gretly appreciated as i have been trying to do this for days now!

    Ive read all the tutorials and it still wont work. Ive tried both the
    ImageIcon anIcon=new ImageIcon("image.jpg");
    and the
    Image image = Toolkit.getDefaultToolkit().getImage("blah.gif" );
    I was wondering could it be something to do with XP or the java compiler im using?im using Forte for Java v3.The code complies fine but when i run it nothing appears!

  • Retrieving Images Embedded In XML (from rss using xsl)

    I am trying to comsuem and rss feed into my site but i dont seem to see an "image" element in the Item node. can someoen tell me how to retrieve Images Embedded In XML dreamwaever. i am using an xsl fragment on a pap server.
    Doh

    Hi there, I am using a jsp page that takes a xml page from the internet (user defines what page it is) it then takes the xsl feed and transforms the xml with a TransformerFactory object to get the results as an html page, the error is received when the jsp page is called
    Ian

  • 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

  • Retrieving images in lightroom

    I cannot seem to retrieve images from the Library mode. I refer to images that have previously been downloaded and most ranked, tweaked, etc. The message I get is that there is no picture. When I try then to retrieve from the original source, the message is that the photos have already been imported. Darned if I can find them.
    I am currently finding the TIF at the original source, re-naming it slightly and then I can import it -- only to lose it again. A real pain!
    Something I am doing is not right. Tell me.

    Check if you have a Filter applied. Then un-apply it
    Richard Earney
    http://inside-lightroom.com

  • Retrieve image from my sql database using jsp

    I want to retrieve image from my sql (blob type) & save it in given relative path in server .(using jsp and servlets)
    please give me some sample codes.

    PreparedStatement pst = null;
      ResultSet rs=null;
    pst = conn.prepareStatement("select image from imagedetails where imageid='"+imageid+"'");
    rs=pst.executeQuery();
    while(rs.next())
                                byte[] b=rs.getBytes("image");
                                FileOutputStream fos=new FileOutputStream("c://image.jpg");
                                fos.write(b);
                            } hi this the code to retrieve the image from DB and write to a file.

  • Saving/Retrieving Images

    I want to use a mySQL database to store and retrieve images. The images will first be read from a File and saved to a table, then later the image should be read from the table into a Java image object.
    I'm not sure what field to use (TEXT or BLOB) and how to save the image to the database, and how to read the field from the database into an Image object.
    Any suggestions?

    You can save and retrieve images in MySQL as BLOB's. However, the default settings of MySQL will limit the size of your images to about 1 MB in size. This is a limitation of the communication settings, and not a table limitation. To change the setting, you need to edit the max_allowed_packet in the my.cnf configuration file.
    http://www.geocities.com/shrm_phr/index.html

  • Using Java to Retrieve Images from Oracle

    OracleResultSet.getCustomDatum method is deprecated. I was using this method to retrieve an ORDImage from an Oracle 9i database. What are developers using instead of getCustomDatum to retrieve images from the database. Thanks for all help in this matter.

    Hi use getBinaryStream(java.lang.String) or getBinaryStream(int) of java.sql.ResultSet for retrieving images from database
    Hope it will be useful
    regards
    chandru

  • How to insert /retrieve images ??

    hi everyone...
    i want to get image from my filesystem onto my form and insert the image into oracle 10g database from my form using forms 6i
    and
    i want to retrieve images from oracle 10g database onto forms using forms 6i.
    if possible i want to generate a report to print the retrieved images from my form using forms 6i.
    please kindly help me with detail coding as i'm new to forms and i had given to perform the above task.
    thanks in advance
    Regards,
    Santosh.Minupurey

    create a table with 2 fields (label varchar2(25) ,image blob)
    create a data block with the above table
    place 2 buttons (get and save) on the form
    trigger for get_button (// when_button_pressed event)
    read_image_file(:block_name.text_item_name,'jpg',blockname.image_item_name); --this will retrieve image from the local system and place it on the image item
    (enter the full path of image with extension in text_item after complie)
    trigger for save_button (// when_button_pressed event)
    read_image_file(:block_name.text_item_name,'jpg',blockname.image_item_name);
    commit; --saves it in the database
    sorry but i couldn't retrieve it from database....

  • Upload Image file and retrieve image file

    How to upload image and How to retrieve image file from Database?
    Plz., give some example
    I am waiting for your valuable guidance.
    Plz., help me any one.

    This question has been asked and answred so meny times.
    I dont feel like writing the answer yet another time so please doa search.

  • I get error message each time I try to retrieve image (BLOB) from Oracle

    Can anyone help me?
    I am working with Servlet and JDBC with Oracle database. I can insert an image (GIF file) in a Oracle
    table in a BLOB field. But everytime I want to retrieve it
    I got an error "AbstractMethodError". My retrieve program (only the main part) is as below:
    String dbURL="jdbc:oracle:thin:@200.200.100.2:1521:tvm";
    String db_username="PROJ1"; String db_password="PROJ1";
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    }catch(ClassNotFoundException e1){ }
    try{
    Connection c=DriverManager.getConnection(dbURL,db_username,db_password);
    // Retrieving image file from database
    RandomAccessFile raf=new RandomAccessFile("//Davison/jakarta/webapps/examples/images/a10.gif","rw");
    PreparedStatement pstmt2=c.prepareStatement("Select fname,photo From testtable1 where fname=?");
    pstmt2.setString(1,"rere100");
    ResultSet rs=pstmt2.executeQuery();
    while(rs.next()){
    Blob blobImage=rs.getBlob("photo");
    int length=(int)blobImage.length();
    byte[] blobArray=blobImage.getBytes1,length);
    raf.write(blobArray);
    raf.close();
    Please help me soon, my email is: [email protected]
    Bye , Rea

    Probably a bit late, but I just got the same problem.
    Oracle seems to instantiate a class which is not fully defined-
    oracle.sql.BLOB. This class has abstract methods, and is therefore
    an abstract class.
    In short, Oracle are stupid fools. How they managed to instantiate
    an abstract class in the first place should be of concern to the
    Java gurus, however. Native code in the OCI driver perhaps?
    If you still need help, you could try uning the Thin driver- or
    a database with a JDBC driver which actually meets the spec. There
    are third party Oracle drivers which might fit the bill- they
    usually cost money, however.

  • How to retrieve image?

    i am working with j2me. in that i need to store and retrieve a image in the database. storing the image is working properly, but retrieving does not working. if any one knows help me...

    there is something called "blob" - datatype in oracle where u can store images. for example, in char - datatype it will take only one byte, for float - datatype it will take 32 bytes, like wise u can store images using blob datatype for storing images in oracle database. and for retreiving those images u need a front end tool to display those retrieved image like JSP. for example if u r attaching any photo for ur passport. and after that if u want to see the status any one day u can ensure that status by seeing ur photo that u have sent before. this is because they have saved ur photo using the "blob" datatype....just check it

  • Question on retrieve image from mysql

    i want to retrieve image from mysql database and display on GUI
    can anyone tell me how to do
    Thank you

    You can use the JDBC API for Java Database Connectivity. With this you can obtain data from the database using Java. There is an excellent tutorial here at Sun.com: http://www.google.com/search?q=jdbc+tutorial+site:sun.com You can get the MySQL JDBC driver at their own site: http://www.google.com/search?q=download+jdbc+driver+site:mysql.com Get the most recent version which suits your environment. There is also good documentation available over there.
    For displaying in the UI, the approach differs per UI. As you didn't mention which UI you are using, I can't help you further in detail.

Maybe you are looking for

  • Can you help me with a printer problem?

    Aloha: I have been using an HP printer Model B210a for several years with out problems. Recently, right at  the end of a 15 page document, it stopped printing with the black ink.  A new black cartridge did not solve the problem. It was suggested that

  • How can I get rid of a virus

    I have a virus and it won't allow me to use mouse, keyboard or wifi

  • N step WF for SC at header level - WS14000133- Restrict view to approvers

    Hello, We are using n step SC approval WF WS14000133 (header level approval). We are using cost center responsibility to determine the approvers and these approvers are arranged in series approval. Multiple approvers for the same cost center are in p

  • Upgrading to ES2.5 from ES 2

    Has anyone run into any issues with LiveCycle Forms ES or Process Management ES after upgrading to ES2.5?  Any bugs or unresolved issues?

  • Conditional Required Fields

    Is it possible to have conditional required fields. As in if a certain box is selected, certain fields will become required. Take a look at this example if this needs clarification. In this example, the left 3 text boxes are required. If I check the