Inserting large xml data into xmltype

Hi all,
In my project I need to insert very large XML data into xmltype column.
My table:
CREATE TABLE TransDetailstblCLOB ( id number, data_xml XMLType) XmlType data_xml STORE AS CLOB;
I am using JDBC approach to insert values. It works fine for data less than 4000 bytes when using preparedStatement.setString(1, xmlData). As I have to insert large Xml data >4000 bytes I am now using preparedStatement.setClob() methods.
My code works fine for table which has column declared as CLOB expicitly. But for TransDetailstblCLOB where the column is declared as XMLTYPE and storage option as CLOB I am getting the error : "ORA-01461: can bind a LONG value only for insert into a LONG column".
This error means that there is a mismatch between my setClob() and column. which means am I not storing in CLOB column.
I read in Oracle site that
When you create an XMLType column without any XML schema specification, a hidden CLOB column is automatically created to store the XML data. The XMLType column itself becomes a virtual column over this hidden CLOB column. It is not possible to directly access the CLOB column; however, you can set the storage characteristics for the column using the XMLType storage clause."
I dont understand its stated here that it is a hidden CLOB column then why not I use setClob()? It worked fine for pure CLOB column (another table) then Why is it giving such error for XMLTYPE table?
I am struck up with this since 3 days. Can anyone help me please?
My code snippet:
query = "INSERT INTO po_xml_tab VALUES (?,XMLType(?)) ";
          //query = "INSERT INTO test VALUES (?,?) ";
     // Get the statement Object
     pstmt =(OraclePreparedStatement) conn.prepareStatement(query);
     // pstmt = conn.prepareStatement(query);
     //xmlData="test";
//      If the temporary CLOB has not yet been created, create new
     temporaryClob = oracle.sql.CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
     // Open the temporary CLOB in readwrite mode to enable writing
     temporaryClob.open(CLOB.MODE_READWRITE);
     log.debug("tempClob opened"+"size bef writing data"+"length "+temporaryClob.getLength()+
               "buffer size "+temporaryClob.getBufferSize()+"chunk size "+temporaryClob.getChunkSize());
     OutputStream out = temporaryClob.getAsciiOutputStream();
     InputStream in = new StringBufferInputStream(xmlData);
int length = -1;
int wrote = 0;
int chunkSize = temporaryClob.getChunkSize();
chunkSize=xmlData.length();
byte[] buf = new byte[chunkSize];
while ((length = in.read(buf)) != -1) {
out.write(buf, 0, length);
wrote += length;
temporaryClob.setBytes(buf);
log.debug("Wrote lenght"+wrote);
     // Bind this CLOB with the prepared Statement
     pstmt.setInt(1,100);
     pstmt.setStringForClob(2, xmlData);
     int i =pstmt.executeUpdate();
     if (i == 1) {
     log.debug("Record Successfully inserted!");
     }

try this, in adodb works:
declare poXML CLOB;
BEGIN
poXML := '<OIDS><OID>large text</OID></OIDS>';
UPDATE a_po_xml_tab set podoc=XMLType(poXML) WHERE poid = 102;
END;

Similar Messages

  • How to insert large xml data into database tables.

    Hi all,
    iam new to xml. i want to insert data in xml file to my database tables.but the xml file size is very large. performance is also one of the issue. can anybody please tell me the procedure to take xml file from the server and insert into my database tables.
    Thanks in advance

    Unfortunately posting very generic questions like this in the forum tends not to be very productive for you, me or the other people who read the forum. It really helps everyone if you take a little time to review existing posts and their answers before starting new threads which replicate subjects that have already been discussed extensively in previous threads. This allows you to ask more sensible questions (eg, I'm using this approach and encountering this problem) rather than extremely generic questions that you can answer yourself by spending a little time reviewing existings posts or using the forum's search feature.
    Also in future your might want to try being a little more specific before posting questions
    Eg Define "very large". I know of customers who thing very large is 100K, and customers who think 4G is medium. I cannot tell from your post what size your files are.
    What is the content of the file. Is it going to be loaded into a single record, or a a single table, or will it need to be loaded into multiple records in a single table or multiple records in multiple tables ?
    Do you really need to load the data into exsiting relational tables or could your application work with relational views of the XML Content.
    Finally which release of the database are you working with.
    Define performance. Is it reasonable to expect to process this kind of document on this machine (Make, memory, #number of CPUs, CPU Speed, number of discs) in this period of time.
    WRT to your original question. If you take a few minutes to search this forum you will find a very large number of threads with very similar titles to yours. These theads document a number of different approaches that can be used to solve this problem.
    I suggest you start by looking for threads that cover topics like DBMS_XMLSTORE, XMLTable(), Relational Views of XML content, loading XML content in relational tables.

  • How to insert large xml file to XMLType column?

    Hi,
    I have a table with one column as XMLType(Binary XML storage option and Free Text Indexing). When i try to insert a large XML as long as 8kb, i'm getting an error ORA-01704:string literal too long.
    Insert into TEST values(XMLTYPE('xml HERE'));
    How to insert large XML values to XMLType column?
    Regards,
    Sprightee

    For a large XML file, you basically have two options - you can load the string directly as an XMLType, or you can load the string as a CLOB and cast it on the database side to an XMLType.
    If you decide to load the XML as XmlType client-side, then you may be interested to know that versions of Oracle after 11.2.0.2 support the JDBC 4.0 SQLXML standard. See the JDBC driver release documentation here:
    http://docs.oracle.com/cd/E18283_01/java.112/e16548/jdbcvers.htm#BABGHBCC
    If you want to load as a CLOB, then you'll need to use PreparedStatement's setClob() method, or allocate an oracle.sql.clob object.
    For versions before 11.2.0.2, you can create an XMLType with a constructor that includes an InputStream or byte[] array.
    HTH
    Edited by: 938186 on Jun 23, 2012 11:43 AM

  • How to insert 4K of XML data into XMLType column?

    I use OCCI and our Oracle version is 9.2.0.1.0. I have successfully been able to insert xml data (any size) into a clob column using "insert into...values(.., empty_clob()) returning c1 into :3"; and then using Statement::GetClob() to acquire a reference to the internal clob and populate it. I cannot seem to be able to do the same when the column type is of XMLType.
    I could not find a single sample code which demonstrates inserting into a table with a XMLType column. Using SetDataBuffer(OCCI_SQLT_STR) with data over 4000 bytes does not work.
    I'd greatly appreciate any feedback.

    Pretty sure this was a bug in the base 9.2 release which was fixed in a patch drop. Try 9.2.0.6 or later.

  • INSERTION OF XML DATA INTO THE TABLE USING XMLDOM

    hello,
    i am using XMLDOM to insert the data into the table
    i am using different function of it.
    but i am facing the problem to retrive the the multiple entry.
    like in my example i have two entry of the ' po number '
    & i am using the function
    dbms_xmldom.item(l_nodelist, 0)
    i which i have to pass index no.
    & through this i am getting only single entry according to the index no.
    Example on which i am working is
    declare
    l_xml_data CLOB;
    l_xml_doc dbms_xmldom.domdocument;
    l_nodelist dbms_xmldom.DOMNodeList;
    l_node dbms_xmldom.domnode;
    l_xmltype XMLTYPE;
    l_po_num VARCHAR2(30);
    l_cust_ord VARCHAR2(30);
    l_item_code VARCHAR2(30);
    begin
    l_xml_data := '<?xml version="1.0" encoding="UTF-8"?>
    <!--DOCTYPE MobileInventoryResponse SYSTEM "MobileInventoryResponse.dtd"-->
    <MobileInventoryResponse>
         <message>
              <message-header>
                   <message-id>16244182</message-id>
                   <transaction-name>ship-advice</transaction-name>
                   <partner-name>cbeyond</partner-name>
                   <source-url>http://www.brightpoint.com</source-url>
                   <create-timestamp>20080826150709</create-timestamp>
                   <response-request>1</response-request>
              </message-header>
              <ship-advice>
                   <header>
                        <customer-id>297859</customer-id>
                        <shipment-information>
                             <ship-first-name>RA_13Aug_1</ship-first-name>
                             <ship-last-name>MIND</ship-last-name>
                             <ship-address1>test</ship-address1>
                             <ship-city>test</ship-city>
                             <ship-state>VA</ship-state>
                             <ship-post-code>22102-4931</ship-post-code>
                             <ship-country-code>US</ship-country-code>
    <ship-phone1>0040726335068</ship-phone1>
    <ship-email>[email protected]</ship-email>
    <ship-via>FX01</ship-via>
    <ship-request-date>20080826</ship-request-date>
    <ship-request-warehouse>CBY1</ship-request-warehouse>
    </shipment-information>
    <purchase-order-information>
    <purchase-order-number>380928</purchase-order-number>
    <purchase-order-number>380929</purchase-order-number> ----modi by Ananda Dubey
    <account-description/>
    <purchase-order-amount>0.0</purchase-order-amount>
    <currency-code>USD</currency-code>
    </purchase-order-information>
    <order-header>
    <customer-order-number>0002759</customer-order-number>
    <customer-order-date>20080826</customer-order-date>
    <order-sub-total>19.0</order-sub-total>
    <order-discount>0.0</order-discount>
    <order-tax1>0.0</order-tax1>
    <order-tax2>0.0</order-tax2>
    <order-tax3>0.0</order-tax3>
    <order-shipment-charge>18.0</order-shipment-charge>
    <order-total-net>0.0</order-total-net>
    <order-status>Completed</order-status>
    <order-type/>
    <brightpoint-order-number>35028788</brightpoint-order-number>
    <warehouse-id>CBY1</warehouse-id>
    <ship-date>20080826</ship-date>
    </order-header>
    </header>
    <detail>
    <line-item>
    <line-no>1</line-no>
    <item-code>SKU1</item-code>
    <universal-product-code>0</universal-product-code>
    <ship-quantity>1.0</ship-quantity>
    <unit-of-measure>EA</unit-of-measure>
    <serial-list>
    <serial-numbers>
    <esn>TIMI000013</esn>
    </serial-numbers>
    </serial-list>
    <line-status/>
    <base-price>0.0</base-price>
    <line-discount>0.0</line-discount>
    <line-tax1>0.0</line-tax1>
    <line-tax2>0.0</line-tax2>
    <line-tax3>0.0</line-tax3>
    <bill-of-lading>929406733828</bill-of-lading>
    <scac>FX01</scac>
    </line-item>
    </detail>
    </ship-advice>
    <transactionInfo>
                   <eventID>16244182</eventID>
              </transactionInfo>
         </message>
    </MobileInventoryResponse>';
    l_xml_doc := dbms_xmldom.newDomDocument(l_xml_data);
    -- Method 1 to get data
    l_nodelist := dbms_xmldom.getelementsbytagname(l_xml_doc, 'purchase-order-number');
    l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from list
    l_po_num := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_node));
    dbms_output.put_line(l_po_num);
    l_nodelist := dbms_xslprocessor.selectnodes(dbms_xmldom.makenode(l_xml_doc),
    '/MobileInventoryResponse/message/ship-advice/detail/line-item/item-code');
    l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from list
    l_item_code := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_node));
    dbms_output.put_line(l_item_code);
    l_xmltype := XMLTYPE(l_xml_data);
    l_cust_ord := l_xmltype.extract('/MobileInventoryResponse/message/ship-advice/header/order-header/customer-order-number/text()').getStringVal();
    dbms_output.put_line(l_cust_ord);
    dbms_xmldom.freeDocument(l_xml_doc);
    end;
    /

    In the following code
    l_nodelist := dbms_xmldom.getelementsbytagname(l_xml_doc, 'purchase-order-number');
    l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from listYou need to understand what the second parm on the .item call does. See [dbms_xmldom.item|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xmldom.htm#i1126138]
    The nodelist is a 0 based array of information and you are only requesting to pull the node info in the first array position. So to get the info in the second array position, you need to use ", 1)". You can also use .getLength and a loop to parse through everything in the node list.

  • How to insert large xml file ino xmltype column

    Hi all,
    iam using oracle10g. I have a table example1(key_column varchar2(10),xml_column xmltype) like this. i want to insert xml file from server to xmltype column. Can you please anybody suggest regarding this.wht is the size of the xmltype column. is it same as clob like 2GB or sth different. and one more thing is iam creating one procedure in that procedure , in that we are fetching xmltype value into clob varable. is it correct or not...
    Thanks

    Manipulating a single XMLType of 2GB is probably not sensible period. I'm guessing that the content of a file that big is probably a set of smaller XML documents which someone has wrapped a begin and end tag around. Since databases are good at handling collections of documents (or collections of anything else for that matter), you should consider de-compising the large document back into a set of smaller documents before storing it in the database

  • Insert large XML files into 11g

    Can anyone post an example of inserting XML files into a XMLType table? I can use the following to insert files into a CLOB table without problems.
    $lob = oci_new_descriptor($conn, OCI_D_LOB);
              $sql = "insert into D (DATASET_ID, XML_DATA)
    values(
                   dataset_id_seq.NEXTVAL,
                   EMPTY_CLOB( )
              ) RETURNING XML_DATA into :the_blob";
              $stmt = oci_parse($conn, $sql);
              oci_bind_by_name($stmt, ':the_blob', $lob, -1, OCI_B_CLOB);
              oci_execute($stmt, OCI_DEFAULT);
              if ($lob->savefile($f)){
                   oci_commit($conn);
                   echo "Blob successfully uploaded\n";
              }else{
                   echo "Couldn't upload Blob\n";
              oci_free_descriptor($lob);
              oci_free_statement($stmt);

    A small example to insert xml file into oracle xml DB
    //$Xml contains the xml file you want to insert into the database.
    $insertXML = <<<EOF
    DECLARE xml CLOB := $Xml; begin INSERT INTO purchaseorder_as_column VALUES (1,XMLType(xml)); end;
    EOF;
    $stid = oci_parse($c, $insertXML);
    oci_execute($stid);
    //retrieve the xml data from the that table
    $sql = "select XMLTYPE.GetClobVal(xml_document) from purchaseorder_as_column where id=1";
    $stid = oci_parse($c, $sql);
    oci_execute($stid);
    $res = oci_fetch_row($stid);
    $xmldoc = $res[0]->load();
    //Then use simple xml extensions or others as you like to deal with the XML document
    $sxe = simplexml_load_string($xmldoc);
    //other operations with tthe xml data
    var_dump($sxe);

  • Inserting XML data into xmltype column

    Oracle version: 10.1.0.5
    OpenVms Alpha V8.3
    1) Tried this and get the error shown below. Removed charset and placed a zero. Same error.
    INSERT INTO xml_demo (xml_data) -- column of xmltype
    VALUES
    xmltype
    bfilename('XML_DIR', 'MOL.XML'),
    nls_charset_id('AL32UTF8')
    ORA-22993: specified input amount is greater than actual source amount
    ORA-06512: at "SYS.DBMS_LOB", line 637
    ORA-06512: at "SYS.XMLTYPE", line 283
    ORA-06512: at line 1
    2) This PL/SQL block works. However maximum raw size around 32K. The file can be around 100K. May be I can load it into a table of raw and somehow concatnate it to insert. Not sure whether this is possible but I am sure there must me a simple way of doing this.
    Subset of the xml file is pasted below.
    set serveroutput on size 1000000
    DECLARE
    file1 bfile;
    v_xml XMLType;
    len1 number(6);
    v_rec1 raw(32000);
    BEGIN
    file1 := bfilename('XML_DIR','MOL.XML');
    DBMS_LOB.fileopen(file1, DBMS_LOB.file_readonly);
    len1 := DBMS_LOB.getLength(file1);
    v_rec1 := dbms_lob.substr(file1,len1,1);
    v_xml := xmltype(UTL_RAW.CAST_TO_VARCHAR2(v_rec1));
    INSERT INTO xml_demo (xml_data) VALUES (v_xml);
    COMMIT;
    DBMS_LOB.fileclose(file1);
    exception
    when others then
    dbms_output.put_LINE (sqlerrm);
    DBMS_LOB.fileclose(file1);
    END;
    <?xml version="1.0" encoding="UTF-8"?>
    <MolDocument DtdVersion="3" DtdRelease="0">
    <DocumentIdentification v="MOL_20100331_1500_1600"/>
    <DocumentVersion v="1"/>
    <DocumentType v="A43"/>
    <SenderIdentification codingScheme="A01" v="17X100Z100Z0001H"/>
    <SenderRole v="A35"/>
    <ReceiverIdentification codingScheme="A01" v="10XFR-RTE------Q"/>
    <ReceiverRole v="A04"/>
    <CreationDateTime v="2010-03-31T14:10:00Z"/>
    <ValidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Domain codingScheme="A01" v="10YDOM-1001A001A"/>
    <MolTimeSeries>
    <ContractIdentification v="RTE_20100331_1500_16"/>
    <ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A02"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    </MolDocument>

    Marc
    Thanks. I understand what you are saying. I have been copying files in binary mode from NT servers into VMS. I have to get a proper xml file via FTP from the originating system to further investigate.
    I have one last item i need help on. If anything looks obvious let me know:
    +1) The xsd defintion of Qty (type: QuantityType) and EnergyPrice (type: Amount Type)+
                   <xsd:element name="Qty" type="ecc:QuantityType">
                        <xsd:annotation>
                             <xsd:documentation/>
                        </xsd:annotation>
                   </xsd:element>
                   <xsd:element name="EnergyPrice" type="ecc:AmountType" minOccurs="0">
                        <xsd:annotation>
                             <xsd:documentation/>
                        </xsd:annotation>
                   </xsd:element>
    +2) Definition of AmountType and QuantityType in the parent xsd+
         <xsd:complexType name="AmountType">
              <xsd:annotation>
                   <xsd:documentation>
                        <Uid>ET0022</Uid>
                        <Definition>The monetary value of an object</Definition>
                   </xsd:documentation>
              </xsd:annotation>
              <xsd:attribute name="v" use="required">
                   <xsd:simpleType>
                        <xsd:restriction base="xsd:decimal">
                             <xsd:totalDigits value="17"/>
                        </xsd:restriction>
                   </xsd:simpleType>
              </xsd:attribute>
         </xsd:complexType>
         <!--_________________________________________________-->
         <xsd:complexType name="QuantityType">
              <xsd:annotation>
                   <xsd:documentation>
                        <Uid>ET0012</Uid>
                        <Definition>(Synonym "qty") The quantity of an energy product. Positive quantities shall not have a sign.</Definition>
                   </xsd:documentation>
              </xsd:annotation>
              <xsd:attribute name="v" type="xsd:decimal" use="required"/>
         </xsd:complexType>
         <!--________________
    +3. Data in the XML file+
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    +4) When I do the load:+
    the EnergyPrice is saved in the xmltype column as <EnergyPrice v="50"/>
    Losing its decimal value of .45
    +5) When I select as follows:+
    **DEV** SQL>> l
    1 SELECT
    2 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice/@v') v1,
    3 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice') v2,
    4 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/Qty') v3
    5 FROM balit_mol_xml x,
    6 TABLE(
    7 XMLSEQUENCE(
    8 EXTRACT(x.xml_payload, '/MolDocument/MolTimeSeries')
    9 )
    10 ) x2
    11* WHERE EXISTSNODE(x.xml_payload,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1
    +6) get the result+
    50
    AmountType479_T(XDB$RAW_LIST_T('1301000000'), 50)
    QuantityType471_T(XDB$RAW_LIST_T('1301000000'), 50)
    +7) XDB$RAW_LIST_T('1301000000'),+
    Does that tell what I am doing wrong?

  • Unable to insert large blob data into DB

    Hi,
    I have written a piece of code which serializes a java object and writes it into a blob in DB.
    It works pretty fine for small objects of around 3 to 4 KB size, but I start getting trouble with larger objects.
    Here's my piece of code -
    private final static String QUERY_INSERT_AUDIT_DATA = "INSERT INTO " +
    "KAAS_AUDIT_DATA(object_id, object_type_cd, create_by, summary_data) VALUES (?, ?, ?, ?)";
    byte [] byteArray;
    bos = new ByteArrayOutputStream();
    oos = new ObjectOutputStream(bos);
    oos.writeObject(summaryData);
    oos.flush();
    oos.close();
    byteArray = bos.toByteArray();
    bos.close();
    ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
    BufferedInputStream buffInputSteam = new BufferedInputStream(bais);
    trace("addAuditSummary() : byteArray " + byteArray.length);
    trace("addAuditSummary() : buffInputSteam.available " + buffInputSteam.available());
    trace("addAuditSummary() : Calling Query to populating data");
    statement = conn.prepareStatement(QUERY_INSERT_AUDIT_DATA);
    statement.setString(1, objectId.toUpperCase());
    statement.setInt(2, objectType);
    statement.setString(3, createdBy);
    statement.setBinaryStream(4, buffInputSteam, buffInputSteam.available());
    statement.executeUpdate();
    statement.close();
    Basically, I am converting the object to BufferedInputStream to sent it to the BLOB(summary_data).
    The error I get is -
    ][30 Nov 2007 10:38:08] [ERROR] [com.hns.iag.kaas.util.debug.DebugDAO] addAuditSummary() : SQL exception occured while adding audit summary data for Object: BUSINESS_SO_BASE_DEAL
    ]java.sql.SQLException: Io exception: Connection reset by peer.
    at oracle.jdbc.dbaccess.DBError.throwSqlException(Ljava/lang/String;Ljava/lang/String;I)V(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(ILjava/lang/Object;)V(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(Ljava/io/IOException;)V(DBError.java:334)
    at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(Ljava/io/IOException;)V(TTC7Protocol.java:3675)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(BBI[B[Loracle/jdbc/dbaccess/DBType;[Loracle/jdbc/dbaccess/DBData;I[Loracle/jdbc/dbaccess/DBType;[Loracle/jdbc/dbaccess/DBData;I)V(Optimized Method)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(Loracle/jdbc/dbaccess/DBStatement;B[BLoracle/jdbc/dbaccess/DBDataSet;ILoracle/jdbc/dbaccess/DBDataSet;I)I(TTC7Protocol.java:1141)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()V(Optimized Method)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate()I(Optimized Method)
    at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate()I(PreparedStatement.java:94)
    at com.hns.iag.kaas.util.debug.DebugDAO.addAuditSummary(Ljava/lang/String;ILjava/lang/Object;Ljava/lang/String;)V(DebugDAO.java:794)
    at com.hns.iag.kaas.servlets.sdm.action.SummaryAction.perform(Lcom/hns/iag/kaas/servlets/sdm/core/Event;Lcom/hns/iag/kaas/servlets/sdm/core/UserContext;)Ljava/lang/String;(SummaryAction.java:246)
    at com.hns.iag.kaas.servlets.sdm.SDMControllerServlet.process(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(SDMControllerServlet.java:213)
    at com.hns.iag.kaas.servlets.sdm.SDMControllerServlet.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(SDMControllerServlet.java:128)
    at javax.servlet.http.HttpServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava/lang/Object;(ServletStubImpl.java:971)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lweblogic/servlet/internal/FilterChainImpl;)V(ServletStubImpl.java:402)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V(ServletStubImpl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava/lang/Object;(WebAppServletContext.java:6354)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic/security/subject/AbstractSubject;Ljava/security/PrivilegedAction;)Ljava/lang/Object;(AuthenticatedSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(Lweblogic/security/acl/internal/AuthenticatedSubject;Lweblogic/security/acl/internal/AuthenticatedSubject;Ljava/security/PrivilegedAction;)Ljava/lang/Object;(SecurityManager.java:118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic/servlet/internal/ServletRequestImpl;Lweblogic/servlet/internal/ServletResponseImpl;)V(WebAppServletContext.java:3635)
    at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic/kernel/ExecuteThread;)V(ServletRequestImpl.java:2585)
    at weblogic.kernel.ExecuteThread.execute(Lweblogic/kernel/ExecuteRequest;)V(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:170)
    at java.lang.Thread.startThreadFromVM(Ljava/lang/Thread;)V(Unknown Source)
    I would really appreciate any help.
    Thanks
    Saurabh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

    I would say, most likele BufferedInputStream.available() returns an incorrect length. available() does not return the length of the InputStream. See the javadocs for the details
    Additionally: it doesn't make sense at all to wrap the ByteArrayInputStream with a BufferedInputStream, the array is in memory already, so there is no need to buffer the read access to it (you are simply adding more overhead).
    Remove the BufferedInputStream (passing the bais directly to the setBinaryStream() method) and use byteArray.length to indicate the length of the data

  • Insert XML Data Into An Existing PDF Form

    I am working on an application, written with XHTML and JavaScript, and running on AIR, so it is a desktop application.
    Users enter data into an XHTML form and upon submission I create an XML file of the data using JavaScript.
    At any later time users will be able to open the XML file from the application. I will use JavaScript, again, to read the XML and fill in an XHTML form. But at this point I will provide a button for users to generate a PDF with the data. I would then like to insert the XML data into the appropriate fields of the existing PDF form. I would like to continue to do this from within the AIR application using JavaScript.
    Is this possible?
    What version of Acrobat would I need as the developer? Professional or Standard or Other or None?
    What version of Acrobat would the end users need? Professional or Standard or Other or None?
    Can this all be done using only JavaScript and the Acrobat SDK? Does using AIR offer any help (all Adobe products)?
    When the end user clicks the generate PDF button would Acrobat have to open? Can this be done without the user seeing Acrobat open? Either way is ok, I would just like the user to see an alert saying that the file has be generated and point them to its location on the local machine. But again, this is not a requirement.
    Thanks in advance.
    Not asking for source code here, just if its possible. :)
    I'll figure out the how.

    You have two choices
    1) You can use JavaScript in your AIR application to communicate with the JavaScript in the PDF to fill in the form directly. This can all be done inside of your AIR app. This is certainly the best route to go and there is (IIRC) a sample in the AIR SDK.
    2) You can create an XFDF file from your XML data and then have Acrobat/Reader open the XFDF file to fill in the data.
    Both methods will work with Acrobat and Reader - HOWEVER, Reader users won't be able to save the PDF unless it has been Reader Enabled.
    Leonard

  • Inporting XML data into a table

    I have the followiing XML document
    <?xml version="1.0" encoding="utf-8"?>
    <agents count="1382">
    <agent>
    <name>Nancy Palmer</name>
    <email>[email protected]</email>
    <agentid>MLSL:00525350</agentid>
    <officeid>58</officeid>
    <website>http://www.nancypalmer.com</website>
    <photo>https://sites.e-agents.com/Uploads/68/41/6841/Agents/agent_8418_NANCY_PALMER_COLOR_HEAD_SHOT_HIGH_QUALITY_2011.jpg</photo>
    <phone_direct>6504344313</phone_direct>
    <phone_cell>6504920200</phone_cell>
    <mod_time>2012-08-31T05:15:06.933</mod_time>
    </agent>
    <agent>
    <name>Genella Williamson</name>
    <email>[email protected]</email>
    <agentid>MLSL:00755754</agentid>
    <officeid>58</officeid>
    <website>http://www.apr.com/genella</website>
    <photo>https://sites.e-agents.com/Uploads/68/41/6841/Agents/agent_8426_genella.jpg</photo>
    <phone_direct>6504344319</phone_direct>
    <phone_cell>6507870839</phone_cell>
    <mod_time>2010-10-30T15:15:07.603</mod_time>
    </agent>
    <agent>
    <name>Diana Langley</name>
    <email>[email protected]</email>
    <agentid>MLSL:01256202,SFAR:805608</agentid>
    <officeid>50</officeid>
    <website>http://www.apr.com/DLangley</website>
    <photo>https://sites.e-agents.com/Uploads/68/41/6841/Agents/agent_7848_dlangley.jpg</photo>
    <phone_direct/>
    <phone_cell/>
    <mod_time>2011-06-06T05:15:06.587</mod_time>
    </agent>
    </agents>
    I want to load it to the following table
    SQL> desc apr_agent
    Name Null? Type
    NAME VARCHAR2(100)
    EMAIL VARCHAR2(100)
    OFFICEID VARCHAR2(50)
    WEBSITE VARCHAR2(1000)
    PHOTO VARCHAR2(1000)
    PHONE_DIRECT VARCHAR2(100)
    PHONE_CELL VARCHAR2(100)
    MOD_DATE VARCHAR2(100)
    SQL>
    So I created a directory
    create or replace directory APR_STG as '/opt/smarteragent/procdata/APR';
    and I created the following insert statement
    INSERT INTO apr_agent
    (NAME, email, officeid, website, photo, phone_direct, phone_cell, mod_date)
    WITH T AS (SELECT XMLTYPE(BFILENAME('APR_STG','agents.xml'), NLS_CHARSET_ID('AL32UTF8')) xmlcol FROM dual)
    SELECT EXTRACTVALUE(VALUE(x),'/ROW/name') NAME,
    EXTRACTVALUE(VALUE(x),'/ROW/email') email,
    EXTRACTVALUE(VALUE(x),'ROW/officeid') officeid,
    EXTRACTVALUE(VALUE(x),'ROW/website') website,
    EXTRACTVALUE(VALUE(x),'ROW/photo') photo,
    EXTRACTVALUE(VALUE(x),'ROW/phone_direct') phone_direct,
    EXTRACTVALUE(VALUE(x),'ROW/phone_cell') phone_cell,
    EXTRACTVALUE(VALUE(x),'ROW/mod_time') mod_date
    FROM T,TABLE(XMLSEQUENCE(EXTRACT(T.xmlcol,'/ROWSET/ROW'))) x;
    I am currently getting now rows inserted. Not sure why?
    Any help would be greatly appreciated.

    Well, if you were to run the SELECT statement alone (from WITH on down), you would see that it is returning 0 rows. After some head-scratching and searching you would come to realize it is because your XPaths are not finding any data in the XML. In your XPaths, you are looking for a root node of ROWSET with a child of ROW. In the XML, the root node is agents and the child is agent. Assuming you are on 10.2 or later, your SELECT statement itself could be written as
    SELECT NAME, email,
           officeid, website,
           photo, phone_direct,
           phone_cell, mod_date
      FROM XMLTable('/agents/agent'
                    PASSING XMLType(BFILENAME('APR_STG','agents.xml'), NLS_CHARSET_ID('AL32UTF8'))
                    COLUMNS
                    NAME         VARCHAR2(100) PATH 'name',
                    email        VARCHAR2(100) PATH 'email',
                    officeid     VARCHAR2(50) PATH 'officeid',
                    website      VARCHAR2(1000) PATH 'website',
                    photo        VARCHAR2(1000) PATH 'photo',
                    phone_direct VARCHAR2(100) PATH 'phone_direct',
                    phone_cell   VARCHAR2(100) PATH 'phone_cell',
                    mod_date     VARCHAR2(100) PATH 'mod_time');and then you could just append that to your INSERT so you have something like
    INSERT INTO apr_agent
    (NAME, email, officeid, website, photo, phone_direct, phone_cell, mod_date)
    SELECT NAME, email,....If the count of 1382 is to be believed, then you may start wondering why your INSERT is taking so long to process. Performance will depend upon many factors.
    If you are on 11g (any of them), then you have an option to improve performance over 10.2 and earlier versions. You simply create a table, it could even be a Global Temporary Table that looks something like
    create table TEMP_XML (XML_DATA xmltype)
    xmltype column XML_DATA store as securefile binary xml;(if on 11.2.0.2 or later, you only need)
    create table TEMP_XML (XML_DATA xmltype);Then you insert the XML data into it via
    INSERT INTO TEMP_XML VALUES XMLType(BFILENAME('APR_STG','agents.xml'), NLS_CHARSET_ID('AL32UTF8')));and change the above SELECT statement to read from that table instead, such as
    SELECT NAME, email,
           officeid, website,
           photo, phone_direct,
           phone_cell, mod_date
      FROM TEMP_XML tx
           XMLTable('/agents/agent'
                    PASSING tx.xml_data
    ...And then you'll be done with that task.
    Note: Only the first SQL statement was verified, the rest should be valid but have not been executed/verified.

  • Steps to insert xml data into oracle

    Please give me next steps to insert xml data into oracle 9i:
    i've been doing this steps :
    1. create folder in oracle port:8080
    2. copy xsd into folder
    3. register schema
    4. Give me next step...
    5.
    6.
    Thanks

    this is my complete xmlschema
    <?xml version = "1.0" encoding = "UTF-8"?>
    <xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
         <xs:element name = "A3A8Vers" type = "xs:string"/>
         <xs:element name = "F1F5Vers" type = "xs:string">
         </xs:element>
         <xs:element name = "sequence" type = "xs:string">
         </xs:element>
         <xs:element name = "amf" type = "xs:string">
         </xs:element>
         <xs:element name = "trnsKeyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "mac" type = "xs:string">
         </xs:element>
         <xs:element name = "encryptionKey" type = "xs:string">
         </xs:element>
         <xs:element name = "signature" type = "xs:string">
         </xs:element>
         <xs:element name = "signer">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "keyNumber"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "entityNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "keyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "pblKey">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "entityRole"/>
                        <xs:element ref = "keyNumber"/>
                        <xs:element ref = "publicKeyVal"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "ntrTime" type = "xs:string">
         </xs:element>
         <xs:element name = "deActionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "actionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "entityRole">
              <xs:complexType>
                   <xs:attribute name = "role" default = "INVALID">
                        <xs:simpleType>
                             <xs:restriction base = "xs:NMTOKEN">
                                  <xs:enumeration value = "TKD"/>
                                  <xs:enumeration value = "SKD"/>
                                  <xs:enumeration value = "INVALID"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
              </xs:complexType>
         </xs:element>
         <xs:element name = "publicKeyVal">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "exponent"/>
                        <xs:element ref = "mod"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "exponent" type = "xs:string">
         </xs:element>
         <xs:element name = "mod" type = "xs:string">
         </xs:element>
         <xs:element name = "encriptionTransKey" type = "xs:string">
         </xs:element>
         <xs:element name = "keyType" type = "xs:string">
         </xs:element>
    </xs:schema>.
    I use command to create table :
    create table elements of xmltype
    xmlschema "http://192.168.1.1:8080/test.xsd"
    element "publicKey"
    . But why the result,table as object type. so i cant use command "desc <table_name>;"

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • Is there a way to import large XML files into HANA efficiently are their any data services provided to do this?

    1. Is there a way to import large XML files into HANA efficiently?
    2. Will it process it node by node or the entire file at a time?
    3. Are there any data services provided to do this?
    This for a project use case i also have an requirement to process bulk XML files, suggest me to accomplish this task

    Hi Patrick,
         I am addressing the similar issue. "Getting data from huge XMLs into Hana."
    Using Odata services can we handle huge data (i.e create schema/load into Hana) On-the-fly ?
    In my scenario,
    I get a folder of different complex XML files which are to be loaded into Hana database.
    Then I gotta transform & cleanse the data.
    Can I use oData services to transform and cleanse the data ?
    If so, how can I create oData services dynamically ?
    Any help is highly appreciated.
    Thank you.
    Regards,
    Alekhya

  • Inserting XML data into and XML template

    I have XML data structured according to a schema. I also have a
    template structured with the same schema, plus a schema for document formatting. I want to merge the XML data into the Template to produce an output file.
    I know I can write a program to use XPath or DOM, but I am sure a generic solution already exists for this. I did not have any luck with google.
    Suggestions?
    thanks
    d1

    I have XML data structured according to a schema. I also have a
    template structured with the same schema, plus a schema for document formatting. I want to merge the XML data into the Template to produce an output file.
    I know I can write a program to use XPath or DOM, but I am sure a generic solution already exists for this. I did not have any luck with google.
    Suggestions?
    thanks
    d1

Maybe you are looking for

  • BI IP - bad performance in BEX workbooks

    Hi, we use BI IP and have workbooks with 5 to sometimes 10 planqueries (located on individual worksheets). We notice that the performance in BEX is bad. The planning functions itself are performant ( less that 5 seconds in the modeler). However in th

  • Mini and monitor

    I am going to order the NEW mac mini and I have two questions. First, what cable do I need to hook it to my 40" Samsung HD flatscreen tv? Second, I am currently running a PowerMac G4 MDD with the black keys keyboard. Can I use this same keyboard with

  • How to improve jdbc 4 connection and Transact-SQL

    I am using a jdbc 4 connection to connect to Database. With code Class.forName("org.postgresql.Driver"); String url = "jdbc:msql://athens.imaginary.com:4333/db_web"; username = �mycon�; password = �mycon�; Connection  conn = DriverManager.getConnecti

  • External System Data Integration

    Hi Experts, I want to know, how to load the data from JMS (Java Messaging Server) into CRM real time?? Your prompt response will be highly appreciated.... Warm Regards, Peter J.

  • Why does one of my videos show up as "widescreen" in IDVD?

    One of my videos, which I exported from FCP, turns out "widescreen" when I import it in iDVD even though it is a regular 4:3. I was wondering if anyone knew how I could correct this. Thank you!