Insert XML data into the MySQL database

Hi all, I'm new with XML and I need help with the insertion of XML data in the mysql database using coldfusion. I looked on the Coldfusion Documentation and saw how to convert XML to a Coldfusion query... but there was no example of how to do an insert. If anyone can give me a good example or point me towards a good direction on how to do it, I would really appreciate it.

Thank you very much in advance
Alfie

Nevermind, I finally managed to do work!

Tags: ColdFusion

Similar Questions

  • Insert a date in the MySQL database

    I have a problem to enter a date in my database using Dreamweaver.
    I enter the current date in a session variable. It seems OK; When I echo the date, is correct.
    Then I get the date in the database (see attached programme).
    At run time, there is no error message.
    But when I display the date using PHPMyAdmin, the date is set to zero.
    I don't understand.
    Could someone help me?
    Thank you.

    Thank you.
    I found the solution.
    To be inserted into a MySQL database, the date format must be A-m-j.
    It was my mistake.
    Kind regards.

  • Impossible to insert xml data into the table

    HII All,
    I'm unable to parse the following xml file and insert them into the table.


    Version of DB
    ======
    SQL> SELECT *
      2  FROM V$VERSION;
    
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    My DB Table
    Create table rgh_xml_storage
    (
    user_id       varchar2(4000),
    to_type          varchar2(4000),
    mail_id          varchar2(4000),
    subject         varchar2(4000),
    sentDateTime    varchar2(4000)
    )
    Published by: RUSSO April 7, 2011 04:19

    Hello

    Please provide all pertinent details!

    Please correct my insert if statement it must be.

    You have a few bad XPath.
    Here's a way to unnest correctly repeated elements:

    SQL> select x1.user_id,
      2         x1.subject,
      3         x1.sentDateTime,
      4         x2.to_type,
      5         x2.mail_id
      6         --x1.messageBody
      7  from xmltable(
      8    '/emailMessage'
      9    passing xmltype(bfilename('TEST_DIR','email.xml'), nls_charset_id('CHAR_CS'))
     10    columns user_id      varchar2(4000)  path 'headerInformation/sender/user/@userID',
     11            subject      varchar2(4000)  path 'headerInformation/subject',
     12            sentDateTime varchar2(4000)  path 'headerInformation/sentDateTime',
     13            messageBody  clob            path 'messageBody',
     14            my_xml       xmltype         path 'headerInformation/recipients'
     15   ) x1,
     16   xmltable(
     17    '/recipients/recipient'
     18    passing x1.my_xml
     19    columns to_type      varchar2(4000)  path '@type',
     20            mail_id      varchar2(4000)  path 'user/@emailAddress'
     21   ) x2
     22  ;
    
    USER_ID              SUBJECT                                          SENTDATETIME                   TO_TYPE   MAIL_ID
    -------------------- ------------------------------------------------ ------------------------------ --------- ------------------------------------------
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   to        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    
    13 rows selected
     
    
  • Insert XML data from the Table-> back to null

    Dear Experts,

    -I have table xml as below:

    Example of CREATE TABLE (XML_spec XMLTYPE);

    Insert in the example
    Select ' < name of Message = "dataStaticInvestor" type = "IncomingMessage" >
    < name of field = "batchReference" > OPENINGBATCH000000 < / field > < List name = "data" >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < / list >
    < / message > ' double.

    Select * example;

    create table hasil1 (c1 varchar2 (500), c2 varchar2 (500), c3 varchar2 (500));

    -This step I create the procedure to insert xml data into the table as the batch.

    DECLARE
    x XmlType;
    BEGIN
    Select XML_SPEC in x for example;

    insert into hasil1
    SELECT
    p.Extract('/Record/Field/@externalReference').getstringval (C1),
    p.Extract('/Record/Field/@participantID').getstringval (C2),
    p.Extract('/Record/Field/@participantName').getstringval () as c3
    TABLE (XMLSequence (Extract(x,'Message/List/Record'))) p;
    commit;
    END;
    /

    -when the result of select hasil1, the output is back 3 rows and 3 columns, but all data is a null *.

    Best regards
    Sigcle

    You don't explain what output you need, but I guess something like this:

    SQL> insert into hasil1 (c1, c2, c3)
      2  select x.c1, x.c2, x.c3
      3  from example t
      4     , xmltable(
      5         'Message/List/Record'
      6         passing t.xml_spec
      7         columns c1 varchar2(500) path 'Field[@name="externalReference"]'
      8               , c2 varchar2(500) path 'Field[@name="participantID"]'
      9               , c3 varchar2(500) path 'Field[@name="participantName"]'
     10       ) x
     11  ;
    
    3 rows inserted
    
    SQL> select * from hasil1;
    
    C1                     C2        C3
    ---------------------- --------- --------------------------------
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
     
    
  • Load xml data into the table

    Hi all

    I have an XML (emp.xml) with data below:

    -< root >
    -< row >
    < name > steve < / lastname >
    < 30 > < / Age >
    < / row >
    -< row >
    < name > Paul < / lastname >
    <>26 < / Age >
    < / row >
    < / root >

    I would like to create a stored procedure to store the xml data into the EMP table.

    EMP
    LastName age
    Steve 30
    Paul 26

    I tried to watch all threads related to this forum, but cannot find the right wire. Any help is greatly appreciated. Thank you

    With

    SQL>  select * from xmltable('root/row' passing xmltype('
    
    steve
    30
    
    
    Paul
    26
    
    ') columns lastname path 'lastname',
                       Age path 'Age')
    /
    LASTNAME   AGE
    ---------- ----------
    steve      30
    Paul       26   
    

    You can now just make a

    Insert into emp as select...

  • Insert xml files into the table

    Hi all

    How to create an application, which allows me to download an xml file and insert the file into a table, looking something like what makes the apex, with 'data-> data-> Data Load XML Workshop'.

    I tried to create it using this link https://forums.Oracle.com/message/9170494 # 9170494

    but when loading the file and send it (current executing the "sp") sends the error "ORA-22285: file for FILEOPEN operation or non-existent directory.

    I could slightly auxiliary

    concerning

    This idea is troubling for me.

    The XML file DOES NOT CHANGE.  This is the goal.  You have a DTD/XST that defines where in the XML hierarchy, a data element is and (so) how to access it.  With this information, you can hardcode things.

    Therefore, you should have no reason for that functionality 'map the data column in the table column"of the data loader since all mappings will be always the same.

    As a simple INSERT... The SELECT statement can (and should) be used.

    (use the FUSION if you update / insert data).

    I copy + paste some of my code in a procedure that I use.

    You will need to replace the parameter name (p_filename) with the value of appropriate link (name of item)

      declare
        l_XML XMLType;
      begin
        /* get file from APEX WWV_FLOW_FILES */
        begin
            select XMLType( blob_content, 1 ) -- 1 means that the file is USACII encoded. this may need to be changed.
              into l_XML
            from wwv_flow_files where name = p_filename; -- replace this with the appropriate ITEM NAME
        exception
          when no_data_found then
            raise_application_error( -20001, 'not in FLOW: ''' || p_filename || '''' );
        end;
    
        /* you'll need to figure this one out */
        INSERT INTO T (...)
        SELECT ..
        FROM  XMLTable( '/'
    pasing l_xml
                columns
                       PATH  -- repeat for each "column" you want to extract
            );
    
       delete from wwv_flow_files where name=p_filename;
      end;
    
  • Error when inserting XML Date in the Table

    Hi all

    I am working on Oracle 11 g and trying to insert a date XML in the table but get error - below

    Query - insert into TableName (ID, CREATION, CREATEDBY) VALUES (50, *'2010 - 12-15 T 12: 57:19'*, 'Name')

    Error - java.sql.SQLDataException: ORA-01861: literal does not match the format string

    CREATED column datatype is Date

    When I try to use sysdate instead of hard-coding XML date of obtaining inserted successfully into the table. Please let me know how to pass this XML format date.

    Thanks in advance.

    Concerning
    Nikhil

    I don't see any XML in what you posted. In any case:

    "2010 12-15 T 12: 57:19'.

    is a string, not a date. Use:

    to_date('2010-12-15T12:57:19','YYYY-mm-dd"T"HH24:mi:SS')

    For example:

    SQL> create table tbl(created date);
    
    Table created.
    
    SQL> insert into tbl values('2010-12-15T12:57:19');
    insert into tbl values('2010-12-15T12:57:19')
                           *
    ERROR at line 1:
    ORA-01861: literal does not match format string
    
    SQL> insert into tbl values(to_date('2010-12-15T12:57:19','YYYY-MM-DD"T"HH24:MI:SS'))
      2  /
    
    1 row created.
    
    SQL> 
    

    SY.

  • Reading XML data into the dynamic text object

    XML... < Quesiton > there is a long line of text from the XML file. < / Question >

    I have an XML file that I've read in a long line of text. I tried to format the string of information with a line break. Have tried to use < br / > and setting the text as htmlText and works except there is an empty line between the sentances. Tried to use the \n and affecting the text object just text, but that brings the \n in the text string.

    Any suggestions how to make text coming to have a line break?

    Well guess what? I've just entered my code and added in my XML CDATA, as I had done before but this time it worked! GO figure... Thanks for the suggestion.

  • Insert XML data

    I'm trying to insert xml data into the table with the oracle sql developer - sql + it works correctly, but it is very difficult to work with her. How ro resolve this problem?

    Create table credit of XMLType;
     INSERT INTO credit VALUES
    (xmltype(
    ' <?xml version="1.0"?> 
      <creditid>a7565</creditid>'
      ));
    I received the error report:
    SQL error: ORA-31011: failed to parse XML
    ORA-19202: an error has occurred in the processing of XML
    LPX-00209: PI names beginning with XML are reserved
    Error on line 1
    ORA-06512: at "SYS." XMLTYPE", line 310
    ORA-06512: at line 1
    31011 00000 - "XML parsing failed"
    * Cause: XML parser returned an error trying to parse the document.
    * Action: Check whether the document to parse is valid.


    Thank you.

    Published by: user11974179 on 2012.5.1 14:15

    And in case you do not have access to MOS, just remove the space to the left of the XML string:

    INSERT INTO credit VALUES(
    xmltype('
      a7565')
    );
    
  • How to insert the legacy data into the QP_RLTD_MODIFIERS table?

    How insert Legacy data into the QP_RLTD_MODIFIERS table in the instance of R12.

    I would use the QP_Modifiers_PUB API. Process_Modifiers to push the old data on prices in R12.  QP_RLTD_MODIFIERS is only used for certain types of discounts (in my prod environment, only the promos are given in this table).

  • Cannot insert data into the database

    Hello world

    I stuck with a problem in DB juice. When I try to insert data into the database using DB tool, I get a repeated error message (error 1). Please find the my vifile below and solve say.

    Problem is use Labiew 8.2. So try to answer accordingly

    Try it with a cluster instead of a string or an array.

  • How to insert data into the database using smartview

    Hello
    I am trying to insert data into the database using * "Send data" * button on the Ribbon of Essbase.
    My database is empty.

    I opened an ad hoc network, it returns * "#missing" * in all cells
    I have modified the cells and provided data in the cells that I want to. Now, I supported on * "Send data" * button.
    It just reloaded the adhoc grid instead of submit data, I rechecked the data through data console Administrative Service are not inserted.

    I am following the right way to insert data? If not, could you please suggest me how (Populate) insert default data in the database?

    --
    VINET

    You go about it the right way, once you have submitted if you réactualisiez then data values should be there, if you POV is against members of dynamic calc and then data not written to the database, you need to check the Member properties of your POV.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Error inserting data into the database of JSF

    Hi all

    I have a form and a button of validation. I created the form using the editable view object created on an entity object. When the student has table (base table of data in which I have to enter data) was empty, I managed to insert the data into the table.when I run the same second time application it shows data that I entered previously. But iam able to modify this data and insert the new record again. What should I do so that it does not show the data I already inserted previously when I run again. I think that iam missing something. Please suggest.

    Thank you.

    Here are two ways to achieve the same thing:

    -If you use taskflows, you can add createInsert action as activity by default and then have a navigation from this at the registration page so that the creation form will be shown on the loading of the page. As a result, you can directly enter and validate.
    -If not, have binding action createInsert in your pagedef and add an executable invokeAction for the same thing with prepareModel so that the registration form empty appears when loading the page

    Jean Lou

  • Reading file and dump the data into the database using BPEL process

    I have to read the CSV file and insert data into the database... To do this, I created some asynchronous bpel process. Adapter filed added and associated with the receive activity... Adapter DB has added and associated with the Invoke activity. Receive two total activity are available in the process when trying to Test em, receive only the first activity is complete and awaits the second receive activity. Please suggest how to proceed with...

    Thanks, Maury.

    Hi Maury,

    There is no need in step 2 that u mentioned above. I donot find useless a webservice?

    The process will be launched by the CSV file, then using the processing activity, you can put it in the DB.

    There should be no way where you can manually test it by giving an entry. All you can do to test is to put the file in the folder you mentioned when configuring the file adapter.

    You just need to have the composite as below:

    ReadCSVFile---> BPEL--> DB adapter

    And in your BPEL process:

    Recieve--> Transformation activity--> call activity

    Try to work on some samples listed on the oracle site and go through the below URL:

    The playback of the file adapter feature using

    Thank you

    Deepak.

  • What trigger to use to insert data into the table db forms

    Hello

    My form is current having a block of database with the table reference. When you enter data into the form field and click Save. Automatically record is inserted in the database table.
    I want to do this under manual insert. I changed the block of data to a data non-base. Where should I write the insert statement to insert data into the table.
    Is - shutter release key of the form-level validation?

    Please notify.

    Thank you
    Didi.

    You can guide me how to remove the message FRM-40401 no changes to save and instead, I wanted to put 1 transaction record successful... some like it like that.

    Hi didi.
    And this is my last post I'll sleep. ;)
    Take form level trigger named preform
    and write on it

    :SYSTEM.MESSAGE_LEVEL := 5;
    

    I hope this works...

    Hamid

    Mark correct/good to help others to get the right answers. *

Maybe you are looking for

  • Satellite L55-A5284 - audio has little or no bass

    Hello. I recently bought a toshiba satellite L55-A5284, and audio has little or no bass.Even when I plug headphones with decent bass, it seems to be non-existent when I try to play a video or music. When I plug my headphones in another device for mus

  • changing PID gains

    I use the PID advanced VI to a pressure regulator and had tried to vary the winning entry proportional to the VI using an equation based on other settings, such as the behavior was similar to gain scheduling, only contiguous versus by steps.  Unfortu

  • Example one an entry of my analog PXI-7841R DAQ

    I want to sample an analog input from my PXI-7841R AI0 to.  The issue I'm having is when I drag the entry of my project in my VI, the element is defined as a signed integer value, and I can't change it to a floating/double.  Why is this?  I am experi

  • No data lens for the 200mm f2.8 in DPP?

    Just bought the 200mm f2.8 L lens and I am unable to see any 200mm Prime lenses in DPP, am I missing something? Jack

  • Granted refurbished Sansa, want to make sure it's the rocket

    I got a refurbished Sansa and I'm sure it's a rocket, but I guess I should check 90%. BE0805AVUK-2 GB numbers are on the back and the firmware is listed as V01.02.28A. is this enough information to know if it's a rocket? I want to make sure before bu