Database table updation with XML Document data

import java.io.*;
import java.lang.*;
import java.net.URL;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import oracle.xml.sql.dml.OracleXMLSave;
import org.w3c.dom.Document;
public class updateXMLData
public static void main( String argv[] ) throws SQLException,Exception
String tabName = "emp";
Connection conn = null;
String xmlString;
Document doc;
URL filename;
try
//init a JDBC connection using Oracle's JDBC Drivers
String host = "maple"; // change,these won't work
String port = "1521";
String sid = "PBSI";
String s1 = "jdbc:oracle:thin:@" + host + ":" + port + ":" + sid;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection( s1,"scott","tiger");
// Instructions for updating the database rows from XML Document
OracleXMLSave sav = new OracleXMLSave(conn,tabName);
filename = sav.getURL("pbsiempupd.xml");
sav.setRowTag("EMP");
String[] tempArr = new String[2];
tempArr[0]="EMPNO";
tempArr[1]="ENAME";
sav.setKeyColumnList(tempArr);
sav.setUpdateColumnList(tempArr);
int noRows = sav.updateXML(filename);
System.out.println("No of rows updated : " + noRows);
catch (SQLException se)
System.out.println("An SQL exception has occured ");
System.out.println("The error code is : " + se.getErrorCode());
System.out.println("The SQL State is : " + se.getSQLState());
System.out.println("The message is : " + se.getMessage());
catch (Exception e)
System.out.println("Unknown exception has occured");
System.out.println("The class is : "+ e.getClass());
System.out.println("The message is : "+e.getMessage());
finally
if (conn != null) conn.close();
The input XML Document is given below :- in 'pbsiempupd.xml'
<?xml version="1.0"?>
<ROWSET>
<EMP>
<EMPNO>8888</EMPNO>
<ENAME>RAO THOTAKURA</ENAME>
</EMP>
<EMP>
<EMPNO>9999</EMPNO>
<ENAME>BAVA MANI</ENAME>
</EMP>
<EMP>
<EMPNO>7777</EMPNO>
<ENAME>SRINIVAS M</ENAME>
</EMP>
</ROWSET>
After executing this class with 'java updataXMLData' I'm getting following runtime error message :-
Unknown exception has occured
The class is : class oracle.xml.sql.OracleXMLSQLException
The message is : Exception 'java.sql.SQLException:Missing IN or OUT parameter at index:: 1'
encountered during processing ROW element 0All prior XML row changes were rolled back.
in the XML document.
Please anybody could explain how to solve it.
Thanks
Sambasivarao Thotakura

See my reply to your other question. thanks.

Similar Messages

  • Updating a XML document with a processing instruction

    Greetings Guru's
    I have a fully functional XML database solution for our new system. The only thing left is for me to update a xml document in the database with a processing instruction to find the style sheet (JAXB strips it out when the XML must go back into the database).
    I can update complete nodes and node elements in the xml document using updateXML in a regular update statement, but I do not know how to add the following processing instruction to my documents.
    <?xml-stylesheet type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"?>
    [pre]
    Thanks in advance
    Derrick                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    SQL> var xmltext varchar2(4000)
    SQL> --
    SQL> begin
      2    :xmlText := '<Hello>World</Hello>';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> drop table t
      2  /
    drop table t
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> create table t of xmltype
      2  /
    Table created.
    SQL> set long 10000
    SQL> --
    SQL> insert into t values (xmltype(:xmltext))
      2  /
    1 row created.
    SQL> select *
      2    from t
      3  /
    SYS_NC_ROWINFO$
    <Hello>World</Hello>
    SQL> update t set object_value = updateXML
      2                              (
      3                                object_value,
      4                                '/',
      5                                xmlconcat
      6                                (
      7                                  xmlpi("xml-stylesheet",'type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"'),
      8                                  object_value
      9                                )
    10                              )
    11  /
    1 row updated.
    SQL> select * from t
      2  /
    SYS_NC_ROWINFO$
    <?xml-stylesheet type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"?>
    <Hello>World</Hello>
    SQL>

  • How to insert data into a table from an xml document

    using the XmlSql Utility, how do I insert data into a table from an xml document, using the sqlplus prompt.
    if i use the xmlgen.insertXML(....)
    requires a CLOB file, which i dont have, only the xml doc.
    Cant i insert directly from the doc to the table?
    the xmlgen examples I have seen first convert a table to a CLOB xmlString and then insert it into another table.
    Isnt there any other way?

    Your question is little perplexing.
    If you're using XML SQL Utility from
    the commandline, just use putXML.
    java OracleXML putXML
    null

  • Exporting data from database tables to a XML file

    Hi,
    We want to export data from Oracle database tables to an XML
    file. What tool can we use for this purpose, and how do we go
    about it ?
    Can we extract data only from an Oracle8 database, or can we
    extract data from Oracle7.3 databases too ?
    Any help in this regard would be appreciated.
    Thanks
    Dipanjan
    null

    Dipanjan (guest) wrote:
    : Hi,
    : We want to export data from Oracle database tables to an XML
    : file. What tool can we use for this purpose, and how do we go
    : about it ?
    : Can we extract data only from an Oracle8 database, or can we
    : extract data from Oracle7.3 databases too ?
    : Any help in this regard would be appreciated.
    : Thanks
    : Dipanjan
    Start by downloading the XML SQL Utility and make sure you have
    the approriate JDBC 1.1 drivers installed for your database.
    There are samples which will get you going included in the
    archive.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Database table of Match approval level data in shipment more tab

    hi friends
    i need to know the database database table of Match approval level data in shipment > more tab of PO.
    pls help. its urgent.

    Hi friends
    Thank you all for reply. 2-Way, 3-Way or 4-Way values are coming against particular item according to the following combination of values in inspection_required_flag and receipt_required_flag column of PO_line_locations_all.
    4-WAY :Inspection_required : Y , Receipt_required : Y
    3-WAY :Inspection_required : N , Receipt_required : Y
    2-WAY :Inspection_required : N , Receipt_required : N
    it refers there is no fixed column in table based on which 2-Way, 3-Way or 4-Way values are coming for MATCH APPROVAL LEVEL field in that form. am i right? pls response.
    One more thing, inspection_required_flag and receipt_required_flag columns are also available in mtl_system_items_b. My question is when a PO is created with any item which value combination is prioritized. i mean when i open Shipment form and go to More Tab, a value for MATCH APPROVAL LEVEL field is automatically set for that item. Where does that value come from? does it come from PO_line_locations_all or mtl_system_items_b ?
    if my concept is not wrong it comes from mtl_system_items_b. after saving that PO the value is then stored in PO_line_locations_all.
    if my concept is wrong in any way pls let me know. Thanks
    Edited by: Lisan on Jul 15, 2009 9:45 AM

  • RAISING AN EVENT WHEN DATABASE TABLE UPDATES

    hi all,
             i want to raise an event when database table updates.For eg : if a price of a material has been changed then i have to raise an event and run the abap program in back ground.i know transaction SM62 to create event, i dont know about transaction SM64. please give me the procedure how to solve this problem. i dont know work flow. please give me a sample code how to raise event.
    thanka and regards
    suresh

    Hi Suresh
    It is important to understand that the SAP architecture abstracts the database from the application.
    I think that you should look for ways that the application triggers an event when an update has taken place, rather than the DB.
    Two ways of doing this that spring to mind are change pointers (for the ALE interface, see menu SALE) and Business Transaction Events (various things including CRM integration, see menu FIBF).
    The latter works very well for sending prices to CRM when they change. I am more familiar with this than ALE so I will discuss it.
    If you go to menu FIBF and then follow menu path Environment -> Info System (P/S), and then run the report for event 00503301, you can find documentation and a sample function module that you can copy.
    Once you register your new function module in the event tables then it will be called when prices are changed.
    Cheers
    Dom

  • How to check empty return from Get XML Document Data?

    If Get XML Document Data doesn't return a result, how do you test it? String.isEmpty() doesn't do the trick, it still throws the exception "java.lang.NullPointerException". I can't seem to be able to match that up to a cisco exception with a "On Exception Goto" step (which I put right before the XML Document Data step). Any clues anyone?

    Hi,
    Try this:
    variable=Get XML Document Data ()
    if(variable == null) then
         true
         false
    Gabriel.

  • Cisco UCCX 10.6 Get XML Document Data XPath count() function

    Hi
    I'd like to retrieve the number of XML nodes in a document to make a script more efficient.
    e.g. with this XML, I'd like to know how many <message> nodes there are:
    <messages>
    <message>contentA</message>
    <message>contentA</message>
    <message>contentA</message>
    </messages>
    I've tried iNodeCount = Get XML Document Data (inputXMLfile, "count(//messages/message)")
    If I try this in an XPath expression tester then I get the result I'm expecting - an integer of 3. However, in UCCX this produces the error "Can not convert #NUMBER to a NodeList!"... What am I doing wrong?
    Thanks

    Hi, 
    you may want to use a Set or a Do step to execute Java code. 
    First, reference the XML file (within the repository) by calling DOC[myFile.xml] and of course, assigning this value to a Document type variable, e.g.: 
    Set myDocument = DOC[myFile.xml]
    Then add a Do step that actually does the XPath part of the job. 
    There's a nice step by step explanation of it here: http://viralpatel.net/blogs/java-xml-xpath-tutorial-parse-xml/
    Remember, you can get the Inputstream object of the myDocument variable using the getInputStream() method on it.
    G.

  • UCCX XPath on Get XML Document Data Step always returns null

    Hello,
    Can someone tell whats wrong with my XPath, because it always returns null. I have tried different variations and nothing. I'm using UCCX 7.0
    XML
    <?xml version="1.0" encoding="utf-8" ?>
    <GetManagersResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.labdomain.com/">
      <ClaimManagersList>
        <X_CLAIM_MANAGER>
          <ClaimManagerUserName>test</ClaimManagerUserName>
        </X_CLAIM_MANAGER>
      </ClaimManagersList>
    </GetManagersResult>
    XPATH
    "/descendant::GetManagersResult/child::ClaimManagersList/child::X_CLAIM_MANAGER/child::ClaimManagerUserName"
    During debug, this is the value of the xml document when it reaches the Get XML Document Data step:
    TEXT[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<GetManagersResult xmlns=\"http://www.labdomain.com/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <ClaimManagersList>\r\n    <X_CLAIM_MANAGER>\r\n      <ClaimManagerUserName>test</ClaimManagerUserName>\r\n    </X_CLAIM_MANAGER>\r\n  </ClaimManagersList>\r\n</GetManagersResult>]

    It's your XML namespace in the root element.
    First off, I have never seen the CRS Editor play nice when XML namespaces are involved.
    Secondly, with your namespace in place, not even a generic xpath expression tester can find your data.  See attachements.
    I think that if you find a way to either: not send, or remove the namespace from your document, your xpath expression will work.
    With Namespaces
    Without Namespaces

  • Xpath and Get XML Document Data

    Good Morning,
    I have just recently gotten involved in a project that requires communicating with some web services (axis2). We have existing scripts that handle this already, but they were built when we weren't on axis2 so now the XML output from the web service call is slightly different and i am no longer able to use the same xpath statement in the Get XML Document Data step.
    I am receiving either null values or a prefix namespace error. I am new to xpath and have been reading as best i can from http://www.w3schools.com/xpath/ to try and understand how to write my statements to pull out the data i want correctly.
    I have read that sometimes the editor has problems if the XML contains namespace declarations, etc.
    Below is an example XML output where I'd like to be able to read the value in the ax211:success. My xpath gets prefix namespace errors as it doesn't recognize ax211.
    Xpath: /descendant::ns:validateCertificationResponse/child::ns:return/child::ax211:success
    Perhaps my xpath statement is just incorrect and wouldn't retrieve what i expect it to....
    Any advice is appreciated.
    Thanks,
    Kevin

    Hi,
    well, it appears that text() is automatically appended to the XPath query for some reason in UCCX, this is why you actually see the text node within the ax211:success element. This //*[local-name()="success"] select the whole node, not its first child (which is actually the first element, which also happens to be a text).
    Anyway,
    // - anywhere
    * - any node
    And within this "everything" you actually search with the condition within the angular brackets.
    G.

  • UCCX GET XML Document data - how to force language path

    Hi,
    I saw that with UCCX, If the trigger have is language FR_CA, when I will use the Get XML Document Data (docTemp, etc,etc )
    It will get the value of the file located in the path of  FR_CA in the document management.
    Lets say, If the trigger language is FR_CA, Is there any way I can use the GET XML Document to open a file in the EN_CA in the document management ?
    How can I do that ?
    ps : The upload document have this function, we can force a language but I have no idea how to handle this with the Get XML Document.
    Thanks

    I will attach a screenshot of how you can specify the language folder that the Document lives in, regardless of the language of the Trigger or Contact.
    Notice that in the variable I am simply referencing the Document filename.  This will assume the language of the Contact.
    But also notice that within the step, I am saying that the Source document should be found in the L[en_CA] language folder. This does not change the language of the Contact; it simply tells the system to look in a different folder for the file.
    Of course, if your Document is not language specific, you could always put it in the Default language folder and then it will be available to all Contacts regardless of Language setting.
    Anthony Holloway
    Please use the star ratings to help drive great content to the top of searches.

  • I am showing two security updates with a 1969 date is that right

    I am showing two security updates with a 1969 date are those right My fox fire start very slow very very slow
    == This happened ==
    Every time Firefox opened
    == about a month ago

    Firefox must have had a problem getting the time for the update from your system clock, and thus the time of that update is '''zero'''. Epoch (the beginning of time) for Unix is 1-1-1970 midnight GMT, less your offset from GMT - which makes it 12-31-1969 and like 2 to 6 pm on North America.

  • Get XML Document Data Issue

    After tweak bunch of times the argument inside "Get XML Document Data" I´m still not able to obtain a no null value. Could someone help me to find out what i´m doing wrong?
    <?xml version="1.0" encoding="UTF-8"?>
    <Holidays>
      <Holiday>Date=1/2/2013</Holiday>
      <Holiday>Date=1/2/2013</Holiday>
      <Holiday>Date=8/4/2013</Holiday>
      <Holiday>Date=9/4/2013</Holiday>
      <Holiday>Date=1/5/2013</Holiday>
      <Holiday>Date=17/5/2013</Holiday>
      <Holiday>Date=27/5/2013</Holiday>
      <Holiday>Date=6/6/2013</Holiday>
      <Holiday>Date=23/6/2013</Holiday>
      <Holiday>Date=6/4/2013</Holiday>
      <Holiday>Date=25/12/2013</Holiday>
      <Holiday>Date=26/12/2013</Holiday>
    </Holidays>
    Xpath:
    "/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST"
    thank in advance.

    Hi,
    The script first obtain today´s date in this format 1/2/2013 and stores in DateString variable. Then create a XML document based on this:
    <?xml version="1.0" encoding="UTF-8"?>
      Date=1/2/2013
      Date=1/2/2013
      Date=8/4/2013
      Date=9/4/2013
      Date=1/5/2013
      Date=17/5/2013
      Date=27/5/2013
      Date=6/6/2013
      Date=23/6/2013
      Date=6/4/2013
      Date=25/12/2013
      Date=26/12/2013
    that i´ve upload to uccx. it uses get XML Document Data function and stores the result in DataResult variable.
    if
    DataResult == null meets True it makes a call redirect to an extension
    if false that means "1/2/2013" was found inside the XML archive and sends to another extension.
    The problem i see through reactive debug is that always return null,
    In brief: I do not know how to tell using the function "find 1/2/2013 inside Holidays.xml document"
    this is what I putted inside get XML Document Data function:
    "/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST"

  • Is it possible to use xml publisher with xml document as data source ?

    I have an application that have to publish document from xml document that are not part a oracle 10g database but will be stored into Oracle Berkeley XML database insteed. Is it possible to use server and/or desktop to publish these documents ?
    I test the desktop edition using the source xml document but it render no data when the template is executed (vizualization)
    I installed the server edition and i'm not able to declare xml document as a data source
    So i have a doubt that xml publisher is able to publish something from a xml datasource
    Thanks

    Yes, it is possible.
    The problem should come from your template. Refer to "edit a RTF template" in the docs.
    A fact is that XML Publisher server edition is not very adapted to an XML file datasource. In order to use it, you should use an HTTP datasource, with the URL of your XML document (that you should place on a web server...). The problem is that this URL is fixed and point always on the same reference...so XML Publisher server edition is not very good for that use.
    I choose to use the XML Publisher Java API which is better for this task.

  • Updating with XML datafiles from Database or Applications Server

    Our Environment: One database server running 10g with multiple application servers.
    My Question: Am I correct in saying that if you want to update a database with XML files using a bfilename and a directory object, that the physical data files must always reside on the Database server?
    Thanks and kind regards
    Adrian

    Thank you very much for the reply.
    Our systems all operate under Unix and I was wondering whether you or anyone else knows if anyone has successfully tried to use 'soft links' to span the file systems to other machines.
    There's obviously a performance downside, but what we are trying to accomplish is leaving all 'data files' on our individual application servers.
    Thanks again
    Adrian

Maybe you are looking for