How to upload a XML File in database

i use Blob type to set domain the Xml file. But i don't know use what class to define it.i only know use OrdHttpUploadFile to define a image. What class do i use to define a Xml file.

during my tries to adapt this code to my needs, following error occured during compilation of the procedure:
PLS-00201: identifier 'IMAGES.MIME_TYPE' must be declared
here is my procedure:
CREATE OR REPLACE PROCEDURE load_file( file_name VARCHAR2 )
AS file_lob BFILE;
binary_lob BLOB;
mime_type images.mime_type%TYPE;
extension_pos NUMBER;
BEGIN
--Use the extension of the file name to determing the MIME-type 
--The MIME-type for a .pdf file will be application/pdf
extension_pos := INSTR( file_name, '.' );
mime_type := 'application/' || SUBSTR( file_name,extension_pos + 1,LENGTH( file_name ) );
-- Insert a new row into the images table. Get the LOB locator
-- for the newly inserted row
-- we will be using that to insert
-- the content from the file.
INSERT INTO TESTBLOB( blobid, filename, mime_type, content )
VALUES( 1, file_name, mime_type, EMPTY_BLOB() )
RETURNING content INTO binary_lob;
-- Open up the file in the IMAGES directory named file_name,
-- load that file into the newly created LOB locator, and
-- close the file
file_lob := BFILENAME( 'TESTDIRECTORY', file_name );
dbms_lob.fileOpen ( file_lob, dbms_lob.file_readOnly );
dbms_lob.loadFromFile( binary_lob,file_lob,dbms_lob.getLength( file_lob ) );
dbms_lob.fileClose ( file_lob );
END;
how do I have to adjust the declaration of the mime_type variable respectively what does images.mime_type%TYPE mean?
katharina

Similar Messages

  • How to upload a XML file to Servlet

    Hi,
    I am new to Java, I have to upload an XML file to java/j2ee server. The web server running on the server is "Tomcat 4.1". My new requirement is I have to upload an "Input.XML" file, can you please tell me how to upload an XML file. If any samples appriciated very soon.
    Thanks & Regards,

    Hi!
    On the client side, the client's browser must support form-based upload. Most modern browsers do, but there's no guarantee. For example,
    <FORM ENCTYPE='multipart/form-data'
    method='POST' action='/myservlet'>
    <INPUT TYPE='file' NAME='mptest'>
    <INPUT TYPE='submit' VALUE='upload'>
    </FORM>
    The input type &quot;file&quot; brings up a button for a file select box on the browser together with a text field that takes the file name once selected. The servlet can use the GET method parameters to decide what to do with the upload while the POST body of the request contains the file data to parse.
    When the user clicks the "Upload" button, the client browser locates the local file and sends it using HTTP POST, encoded using the MIME-type multipart/form-data. When it reaches your servlet, your servlet must process the POST data in order to extract the encoded file. You can learn all about this format in RFC 1867.
    Unfortunately, there is no method in the Servlet API to do this. Fortunately, there are a number of libraries available that do. Some of these assume that you will be writing the file to disk; others return the data as an InputStream.
    You can see more things about Servlet on this website [http://pedrofao.blogspot.com|http://pedrofao.blogspot.com].

  • How to upload an XML file into another system

    Hi friends,
    I have a requirement where I need to upload an  XML file into one system
    which has been downloaded  using  another  system.
    I have tried using the method ' cl_gui_frontend_services=>gui_upload'
    to upload the file but it is going for dump.
    I have used the  method ' w_xml->import_from_file' also,
    but it is also going for dump ,because  both methods are using the same FM
    ' GUI_UPLOAD'.
    Can any one suggest on this.
    Regards,
    Bhargavi.D

    "Here is the  Explaination for uploading the XML   Format file to sap   " through ABAP Program ....
    1. Basically you simply have to convert the XML file into the proper IDoc format. There are many ways to achieve this. One solution would be to convert it externally to SAP, e.g. via VB Script or with an XSLT transformation. Or you use the built in SAP functions for importing an IDoc from an XML stream.
    2. Uploading a file is either done via GUI_UPLOAD or via the usual way of reading a file from the application server (Open dataset. Read dataset) But what do you mean by "send to external system"? Do you want to convert an IDoc into XML? Then you simply define an XML port with WE21 to send the IDoc out.
    Here is an example of code that loads an XML from file and posts it as an IDoc. Please keep in mind that the XML has to be in its canonical format as described in the interface repository: ifr.sap.com (choose the template of the desired IDoc from there as an example).
    data: data_tab type table of char1024.
    data: XML_STREAM type string.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'D:test.xml'
    *   FILETYPE                      = 'ASC'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = DATA_TAB
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'CONVERT_TABLE_TO_STRING'
      EXPORTING
        I_TABLINE_LENGTH       = '1024'
      IMPORTING
        E_STRING               = XML_STREAM
      TABLES
        IT_TABLE               = DATA_TAB[].
    write: / xml_stream color col_total.
    data: CONTENT_LENGTH type string.
    data: CONTENT_TYPE type string.
    data: REMOTE_ADDR type string.
    CALL FUNCTION 'IDOC_INBOUND_XML_VIA_HTTP'
      EXPORTING
        XML_STREAM                      = XML_STREAM
        CONTENT_LENGTH                  = content_type
        CONTENT_TYPE                    = content_type
        REMOTE_ADDR                     = remote_addr
    EXCEPTIONS
       NO_IDOCS_SAVED                  = 1
       TAG_ERROR                       = 2
       NO_DATA_RECEIVED                = 3
       NO_IDOCS_RECEIVED               = 4
       SEGMENT_ERROR                   = 5
       IDOC_WAS_SEND_SECOND_TIME       = 6
       OTHERS                          = 7
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    write: / sy-subrc color COL_NEGATIVE.
    ENDIF.
    reward  points if it is usefull.......
    Girish

  • How to create an Xml File From DataBase?

    hi all
    i have two tables from my database :
    VoucherHeader and VoucherItem
     VoucherHeader has 4 fields:
    VoucherHeaderId
    bigint Unchecked
    VoucherNum bigint
    Unchecked
    VoucherDate nvarchar(50)
    Unchecked
    Comment nvarchar(50)
    Unchecked
    VoucherItem has 8 fields :
    VoucherItem bigint
    Unchecked
    VoucherHeaderRef
    bigint Unchecked
    Row bigint
    Unchecked
    Code1 bigint
    Unchecked
    Code2 bigint
    Unchecked
    ItemComment nvarchar(50)
    Unchecked
    Debit bigint
    Unchecked
    Credit bigint
    Unchecked
    and i fill datatable by this codes:
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.VoucherItemTableAdapter.Fill(Me.DataSet1.VoucherItem)
    Me.VoucherHeaderTableAdapter.Fill(Me.DataSet1.VoucherHeader)
    End Sub
    now i see this result:
    how to send data into an Xml File From DataGridView Header and Item?
    please help me
    thanks all.
    Name of Allah, Most Gracious, Most Merciful and He created the human

    One instruction.  But you do it from the dataset, not the DataGridView
    Me.DataSet1.WriteXml(FILENAME)
    There is a WriteXML method for a DataTable but it gives errors.  Since you dataset has two tables save bot into the same xml file.
    jdweng

  • Pls tell me how to upload from excel file to database.

    hello,experts,
    I want to upload data from excel local file to database table created by myself.when I use function
    CALL FUNCTION 'GUI_DOWNLOAD'
    the data in the internal table just become error code data that can not understand.
    who can help me out?
    thanks.

    Hi,
    1st copy the values in XLS into internal table by using function Module:-
    call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    exporting
    filename = file_name<it is file path of u r XLS>
    i_begin_col = 1
    i_begin_row = 1
    i_end_col = 250
    i_end_row = 1
    tables
    intern = itab<this structure is same like u r database table>
    exceptions
    inconsistent_parameters = 1
    upload_ole = 2
    others = 3.
    if sy-subrc 0.
    then modify or insert these values to database from internal table:-
    modify <DB table> from itab accepting duplicate keys.
    for file popup use :
    at selection-scree on <screen field>.
    call function 'F4_FILENAME'
    exporting
       program = sy-cprog
       dynnr     = sy-dynnr
    importing
       filename = zfilename.
    here zfilename of type rlgrap-filename.
    and pass this as path in ASLA_EXCEL_TO_INTERNAL_TABLE
    Edited by: vijay Mekala on Dec 29, 2007 12:45 PM

  • Upload an XML file into the Internal table

    Hi Guys,
    I want to know, how to upload an xml file into the Internal table through ABAP programming

    you just wanted to load the xml file into internal table (as a table of binary strings)or load the xml data mapped to itab row columns
    for the first one you can simply use gui_upload
    and for the second one you need to load the xml file using gui_upload and use XLST program to transform into an itab
    Regards
    Raja

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • How to upload a Flat file into sap database if the file is in Appl'n Server

    Hello Sap Experts , Can you tel me
    " How to upload a Flat file into sap database if the file is in Application Server.
    what is Path for that ?
    Plz Tel Me its Urgent
    Thanks for all

    Hi,
    ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
    *& Report  ZUPLOADTAB                                                  *
    *& Example of Uploading tab delimited file                             *
    REPORT  zuploadtab                    .
    PARAMETERS: p_infile  LIKE rlgrap-filename
                            OBLIGATORY DEFAULT  '/usr/sap/'..
    DATA: ld_file LIKE rlgrap-filename.
    *Internal tabe to store upload data
    TYPES: BEGIN OF t_record,
        name1 like pa0002-VORNA,
        name2 like pa0002-name2,
        age   type i,
        END OF t_record.
    DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
          wa_record TYPE t_record.
    *Text version of data table
    TYPES: begin of t_uploadtxt,
      name1(10) type c,
      name2(15) type c,
      age(5)  type c,
    end of t_uploadtxt.
    DATA: wa_uploadtxt TYPE t_uploadtxt.
    *String value to data in initially.
    DATA: wa_string(255) type c.
    constants: con_tab TYPE x VALUE '09'.
    *If you have Unicode check active in program attributes then you will
    *need to declare constants as follows:
    *class cl_abap_char_utilities definition load.
    *constants:
    *    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
    *START-OF-SELECTION
    START-OF-SELECTION.
    ld_file = p_infile.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
          MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
          APPEND wa_upload TO it_record.
        ENDIF.
      ENDDO.
      CLOSE DATASET ld_file.
    ENDIF.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *!! Text data is now contained within the internal table IT_RECORD
    * Display report data for illustration purposes
      loop at it_record into wa_record.
        write:/     sy-vline,
               (10) wa_record-name1, sy-vline,
               (10) wa_record-name2, sy-vline,
               (10) wa_record-age, sy-vline.
      endloop.

  • How do I upload an XML file to salesforce using BULK API?

    Hi There,
    Please let me know how do we upload an XML file to salesforce using Bulk API?
    Thanks,
    ET

    Hi,
    I think that this is a more SalesForce.com question and think you will have more chance looking at SOAP API Developer's Guide for salesforce. Sending a SOAP request from the API Server is very straight forward and there are several tutorials and well documented about this.
    Cheers,
    Stefan

  • I want to store an xml file into database, and transport it to the XI.

    tell me  in how many ways we can store a xml file in database.
    one i know is.- create a table with field same as that of XML. store XML file data in it
    and at the time of transfering data to XI fatch data from table and create an XML file and transfer...
    tell me if u know some more

    Dear Swethi,
    You can move images to SAP using SE78. then u can use them where ever u you require them.
    SE78->GRAPHICS->BMAP here give ur image name and click on save
    Rgds,
    Kiran
    Edited by: Kiran on Jun 11, 2009 7:15 AM

  • How to upload and store pic in database through Servlet

    Hi
    I am new to servlet programming. I need some help i am developing shopping cart of pictures
    I have problem in admin module
    When admin upload new picture and description of picture
    i want to store information of uploaded picture in database so that user can view new photographs for shopping
    Now problem is that how to upload and store picture in database and how to retrive picture from datebase and disply on user end
    I am in great difficulty
    I need some sample code
    Can some one help me
    I shall be very thankful

    Use BLOBS to upload and download image files into the database....
    Here is a sample code for doing it from one of my earlier posts....
    http://forum.java.sun.com/thread.jsp?forum=31&thread=143837
    Once you get the file from the database, use the image tag in HTML to display your picture....
    Let me know if you have any further questions....

  • How to Upload a PDF file into BLOB column in a table using Forms 9i

    Can anyone tell me how to upload a PDF file from client system using File dialog window and store its content in BLOB column in a table. The file to be uploaded will be in client side.

    Hi,
    please, search a bit on the forum before do a question:
    Just searching by "upload blob pdf" ...
    How to batch upload PDF files into database BLOB
    Regards,
    Jose.

  • Loading XML files into Database table

    Loading XML files into Database table
    Hi I have some XML files say 100 files in a virtual directory created using &quot;Create or replace directory command&quot; and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packages

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • To fetch XML files from database  AND regarding barcodes

    Hi !!
    I am very new to this forum...this is my first mail to this forum...
    1.) Actually I would like to know how to fetch XML files from database and then how to get the datas from that XML files???Right now i am using struts frame work...If u anyone send some sample code for this one,it is Very helpful for me.....
    2.)Using java ,how to generate Barcodes?In database I have Some serial number.While I try to display the serial number in Front end ,I should display with Barcode Corresponding to that number.Plz send some sample codes if u have.....
    Thanks in ADVANCE,

    PonJAVA wrote:
    Hi !!
    I am very new to this forum...this is my first mail to this forum...
    1.) Actually I would like to know how to fetch XML files from databaseStart with a JDBC tutorial. Check out DAO Pattern and Hibernate as well.
    and then how to get the datas from that XML files???Google Java & XML (there are many ways to do this
    Right now i am using struts frame work...Okay...
    If u anyone send some sample code for this one,it is Very helpful for me..... You haven't provided any detail regarding your task so there's no way anyone could post code for you.
    2.)Using java ,how to generate Barcodes?Search Google
    In database I have Some serial number.While I try to display the serial number in Front end ,I should display with Barcode Corresponding to that number.Plz send some sample codes if u have.....Try a JSP/Servlet tutorial.

  • Generating xml file from database table

    Could anyone please explain how to generate a xml file from a database table.examples will be highly appreciated.
    thanks in advance

    See the release notes for our XSQL Pages component of the Java XDK for a tutorial. There are also lots of examples in Building Oracle XML Applications.
    You use the XML SQL Utility component to accomplish the task. It's part of our Java XDK that you can download from http://otn.oracle.com/tech/xml

Maybe you are looking for

  • Sychronous File Adaptor routing

    Hi there, I'm trying to implement a sychronous file adaptor in my ESB process. I am able to route to the adaptor using a Routing Service that routes to it. This Routing Service will be aclled by a bpel process to kick the File service off. My problem

  • Need alot of help for this huge probl

    I purchased my zen 3 months ago, during that time I've listened to music on it, sometimes I'd even put files on it for storage. But now, all of a sudden I connect it to my USB port and it gives me an error stating that there was an I/O device error.

  • Installing mac os on Mac book with windows xp

    Hi I have a mac book a1278 with windows xp on it, i want to install os x 10.4 that came on 2 cds, but when I put CD and choose to boot from it, the mac book just keeps restarting itself, I have also tried this with external drive and the results are

  • Repost:: OBIEE 11g BI Admin tool not working.

    Hi, could anybody give me any ideas on this? I installed 11g on my machine in a Windows 7 environment but am unable to start the BI Administrator. I do "start Bi services" and get two command windows, one says server started in RUNNING mode, the othe

  • Photoshop CS5 filter gallery 'the operation could not be completed'

    with photoshop cs5 i get for a specific regular user when selecting filter gallery the error message 'the operation could not be completed'. all other users on the same mac show no problems. ???