LPX-00004 - Problems while inserting xml files in a xmltype column

I've faced two problems while trying to insert xml files into my table containing a xmltype column:
create table xml_test (id number(20),content xmltype)
I use following java code for writing xml docs into db:
     conn.setAutoCommit(false);
     OraclePreparedStatement stmt = (OraclePreparedStatement)
          conn.prepareStatement("INSERT INTO xml_test (id,content) VALUES(?,?)");
     File file = new File(file1);
     InputStream in1 = new FileInputStream(file1);
     Reader r1 = new BufferedReader(new InputStreamReader(in1, "UTF-8"));
     int len = 0;
     StringBuffer text = new StringBuffer();
     while ((len = r1.read()) != -1) {
          text.append((char) len);
     in1.close();
     r1.close();
     XMLType poXML1 = XMLType.createXML(conn, text.toString());
     for (int i = 1; i <= 1; i++) {
          stmt.setInt(1, i);
          stmt.setObject(2, poXML1);
          stmt.execute();
     conn.commit();
1. problem: occures only if a xml schema has been assoicated to the specific xmltype column. it seems that the length of a specific xml tag in the document is limited. but why?
java.sql.SQLException: ORA-22814: attribute or element value is larger than specified in type
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
     at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
     at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
     at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
     at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
     at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
     at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
     at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
     at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
     at test.insertXML(test.java:84)
     at test.main(test.java:261)
hier the xml-schema of the xmltype column "content":
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
     <xs:element name="AUTOR-ID" type="xs:string"/>
     <xs:element name="BODY" type="xs:string"/>
     <xs:element name="CONTENT">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="METADATEN"/>
                    <xs:element ref="BODY"/>
               </xs:sequence>
               <xs:attribute name="content-id" type="xs:string" use="required"/>
          </xs:complexType>
     </xs:element>
     <xs:element name="DATUM" type="xs:string"/>
     <xs:element name="KEYWORD" type="xs:string"/>
     <xs:element name="METADATEN">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="DATUM"/>
                    <xs:element ref="TITEL" maxOccurs="unbounded"/>
                    <xs:element ref="KEYWORD" maxOccurs="unbounded"/>
                    <xs:element ref="AUTOR-ID"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="TITEL" type="xs:string"/>
</xs:schema>
2. problem: hier i have no idea what is happening ... please help
java.sql.SQLException: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00004: internal error "MultiChar overflow"
Error at line 61
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
     at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
     at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
     at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
     at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
     at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
     at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
     at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
     at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
     at test.insertXML(test.java:53)
     at test.main(test.java:259)

It's hard for me to tell you more without seeing your instance data, but for problem #1, if you look at the underlying SQL types being generated by your schema, you will see that the default SQL mapping for a "string" in your schema is a VARCHAR2(4000) (and I believe this would be only 2000 for a varying width character set like UTF8).
You can specify that you wish this column to be mapped as a CLOB in your schema if this is the problem. Also note that there is a 64K limit on the size of an individual node in XMLType.

Similar Messages

  • Problem  while reading XML file from Aplication server(Al11)

    Hi Experts
    I am facing a problem while  reading XML file from Aplication server  using open data set.
    OPEN DATASET v_dsn IN BINARY MODE FOR INPUT.
    IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      READ DATASET v_dsn INTO v_rec.
    WHILE sy-subrc <> 0.
      ENDWHILE.
      CLOSE DATASET v_dsn.
    The XML file contains the details from an IDOC number  ,  the expected output  is XML file giving  all the segments details in a single page and send the user in lotus note as an attachment, But in the  present  output  after opening the attachment  i am getting a single XML file  which contains most of the segments ,but in the bottom part it is giving  the below error .
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/SHPORD_0080005842.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    for all the xml  its giving the error in bottom part ,  but once we open the source code and  if we saved  in system without changing anything the file giving the xml file without any error in that .
    could any one can help to solve this issue .

    Hi Oliver
    Thanx for your reply.
    see the latest output
    - <E1EDT13 SEGMENT="1">
      <QUALF>003</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803</NTEND>
      <NTENZ>000000</NTENZ>
      <ISDD>00000000</ISDD>
      <ISDZ>000000</ISDZ>
      <IEDD>00000000</IEDD>
      <IEDZ>000000</IEDZ>
      </E1EDT13>
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/~1922011.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    E1EDT13 with QUALF>003 and  <E1EDT13 SEGMENT="1">
    with   <QUALF>001 having almost same segment data . but  E1EDT13 with QUALF>003  is populating all segment data
    properly ,but E1EDT13 with QUALF>001  is giving in between.

  • Urgent - pls help - Problem while inserting binary file into Oracle DB

    Hi,
    I am trying to insert binary files into a Blob column in a Oracle 10G table.
    The binary files would be uploaded by the web users and hence come as multipart request. I use apache commons upload streaming API to handle it. Finally i am getting a input stream of the uploaded file.
    The JDBC code is
    PreparedStatement ps=conn.prepareStatement("insert into bincontent_table values(?)");
    ps.setBinaryStream(1,inStream,length);
    My problem starts when i try to find the length of the stream. available() method of inputstream does not return the full length of the stream. so i put a loop to read thru the stream and find the length as shown below
    int length=0;
    while((v=inStream.read())!=-1)
    length++;
    Now, though i got the length, my stream pointer has reached the end and i cant reset it(it throws an error if i try).
    So i copied the stream content to a byte array and created an ByteArrayInputStream like this.
    tempByteArray=new byte[length];
    stream.read(tempByteArray,0,length);
    ByteArrayInputStream bais=new ByteArrayInputStream(tempByteArray);
    Now if i pass this bytearray input stream instead of the normal input stream to the prepared statement's setBinaryStream() method it throws an error as
    "ORA-01460: unimplemented or unreasonable conversion requested".
    Now how to solve this?
    My doubts are ,
    1) preparedStatement.setBinaryStream(int parameterIndex, InputStream x, int length) expects an inputstream and its length. if i have the stream how to find its length with out reading the stream?
    2) Also as the length parameter is a integer, what if i have a large binary file whose length runs more than the capacity of integer
    3) Alternatively there is a setBlob(int i, Blob x) in prepared statement. But how to instantiate a Blob object and set it here
    4) Is there any better way to do this.
    Thanks in advance

    "ORA-01460: unimplemented or unreasonable conversion
    requested".When the setBinaryStream method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as a LONGVARBINARY or a BLOB (reference: javadoc)
    1) preparedStatement.setBinaryStream(int parameterIndex,
    InputStream x, int length) expects an inputstream and its length. if i
    have the stream how to find its length with out reading the stream?no. stream may have no specified length. i think you have wrong understanding about stream.
    2) Also as the length parameter is a integer, what if i have a large
    binary file whose length runs more than the capacity of integer
    3) Alternatively there is a setBlob(int i, Blob x) in prepared statement.
    But how to instantiate a Blob object and set it here
    4) Is there any better way to do this.use ps.setBlob(1, instream) instead

  • How to get ALL validate-errors while insert xml-file into xml_schema_table

    How to get all validate-errors while using insert into xml_schema when having a xml-instance with more then one error inside ?
    Hi,
    I can validate a xml-file by using isSchemaValid() - function to get the validate-status 0 or 1 .
    To get a error-output about the reason I do validate
    the xml-file against xdb-schema, by insert it into schema_table.
    When more than one validate-errors inside the xml-file,
    the exception shows me the first error only.
    How to get all errors at one time ?
    regards
    Norbert
    ... for example like this matter:
    declare
         xmldoc CLOB;
         vStatus varchar
    begin     
    -- ... create xmldoc by using DBMS_XMLGEN ...
    -- validate by using insert ( I do not need insert ;-) )      
         begin
         -- there is the xml_schema in xdb with defaultTable XML_SCHEMA_DEFAULT_TABLE     
         insert into XML_SCHEMA_DEFAULT_TABLE values (xmltype(xmldoc) ) ;
         vStatus := 'XML-Instance is valid ' ;
         exception
         when others then
         -- it's only the first error while parsing the xml-file :     
              vStatus := 'Instance is NOT valid: '||sqlerrm ;
              dbms_output.put_line( vStatus );      
         end ;
    end ;

    If I am not mistaken, the you probably could google this one while using "Steven Feuerstein Validation" or such. I know I have seen a very decent validation / error handling from Steven about this.

  • Problem while parsing xml file

    HI
    I have a xml file which looks like this
              <--A>
    <ID>ABCD</ID>
                   <--B>
                   <Amount1>1</Amount1>
                   <Amount2>2</Amount2>
                   <--/B>
                   <--B>
              <Amount1>3</Amount1>
                   <Amount2>4</Amount2>
                   <--/B>
              <--/A>
              <--A>
    <ID>EFGH</ID>
                   <--B>
                   <Amount1>5</Amount1>
                   <Amount2>6</Amount2>
                   <--/B>
                   <--B>
              <Amount1>7</Amount1>
                   <Amount2>8</Amount2>
                   <--/B>
              <--/A>
    (Appended -- before tags so that its displayed properly here)
    I have to parse through this xml file and for each ID,i have to display corresponding amounts.As we can see //A represents each row.
    I have written code like this.
    l_clob := '<<<XML Content as shown above >>>;
    dbms_xmlparser.parseClob(l_parser, l_clob);
    l_doc := dbms_xmlparser.getDocument(l_parser);
    -- Free resources associated with the CLOB and Parser now they are no longer needed.
    dbms_xmlparser.freeParser(l_parser);
    l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//A');
    FOR cur_rec IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
    l_n1 := dbms_xmldom.item(l_nl1, cur_rec);
    lv_id := dbms_xslprocessor.valueOf(l_n1,'ID/text()');
    l_nl2 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//B');
    FOR cur_rec2 IN 0 .. dbms_xmldom.getLength(l_nl2) - 1 LOOP
    l_n2 := dbms_xmldom.item(l_nl2, cur_rec2);
    lv_Amount1 := dbms_xslprocessor.valueOf(l_n2,'Amount1/text()');
    lv_Amount2 := dbms_xslprocessor.valueOf(l_n2,'Amount2/text()');
    dbms_Output.put_line (lv_id ||lv_Amount1|| lv_Amount2 );
    end loop;
    end loop;
    The problem i am facing is , in the second loop i want to disdplay only values corresponding to ID which is coming in first loop.But when i give //B,its going through all the values in xml file under //B but not going through //B part of each record fethed in loop1.
    How can we display Each ID and corresponding amounts only(Not all the Amounts in XML File).
    Thanks
    Pramod
    Edited by: 842802 on Mar 21, 2011 9:27 AM

    No need for Pl/SQL:
    with t as (
    select '<A>
    <ID>ABCD</ID>
    <B>
    <Amount1>1</Amount1>
    <Amount2>2</Amount2>
    </B>
    <B>
    <Amount1>3</Amount1>
    <Amount2>4</Amount2>
    </B>
    </A>
    <A>
    <ID>EFGH</ID>
    <B>
    <Amount1>5</Amount1>
    <Amount2>6</Amount2>
    </B>
    <B>
    <Amount1>7</Amount1>
    <Amount2>8</Amount2>
    </B>
    </A>' x from dual
    select  id,
            amount1,
            amount2
      from  t,
            xmltable(
                     '$d/D/A'
                     passing xmltype('<D>' || x || '</D>') as "d"
                     columns id varchar2(10) path 'ID',
                             B xmltype path '/'
                    ) y,
            xmltable(
                     '$d/A/B'
                     passing y.b as "d"
                     columns amount1 number path '/B/Amount1',
                             amount2 number path '/B/Amount2'
                    ) z
    ID            AMOUNT1    AMOUNT2
    ABCD                1          2
    ABCD                3          4
    EFGH                5          6
    EFGH                7          8
    SQL> SY.

  • Problem while reading XML File from Memory

    I want to read the data from an XML File which is residing in memory.The XML File should be read not by the name or the location of the file but by a Response String.
    So Can anybody help me out how can get this.
    I tried it with BufferedInputStream but BufferedInputStream needs InputStream as a Parameter and i am not able to get what parameter should be passed into the BufferedInputStream as the syntax of this is
    BufferedInputStream(InputStream in)
    Its very Urgent !!!
    Thanks in Advance

    I have created the parsing method.
    The code is like this.
    if(response.toString().equals("CS_NEWS_RESPONSE"))
    *//InputStream in = new BufferedInputStream(InputStream());*
    *//InputStream in = new BufferedInputStream(response.toString());*
    *//BufferedInputStream b = new BufferedInputStream(in);*
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    Document doc = docBuilder.parse(in);
              Element root = doc.getDocumentElement();
    The code will go like this....
    response.toString() is containing the response type which is the identification of that particular XML File. By using this my file is identified and after identification of this file, i should read the contents and parse them.
    Sentences in the bold are the ways. Is this the correct way ??
    Amit Will you be able to help me or is there anybody else who knows about this.
    Edited by: Monadear on Oct 5, 2007 9:37 AM

  • Problem while parsing xml file using DOM

    I have a xml file NewXML.xml. When I parse it I'm not getting the expected output: I'm trying to get only the value of the "name" tag. When I tried getElementByTagName("name"), I'm not getting the expected result.
    Here is my xml file based on a schema
    <?xml version="1.0" encoding="UTF-8"?>
    <student xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="NewXMLSchema.xsd">
    <name>john</name>
    <id>1000</id>
    </student>
    Coding:
    public static void main(String argv[])
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    Document document ;
    try {
    DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse( "NewXML.xml" );
    NodeList nodeList = (document.getElementsByTagName("name") );
    System.out.println(nodeList.getLength()+" node list "+nodeList.item(0));
    System.out.println(nodeList.item(0).getNodeValue());
    NodeList nodeList1 = nodeList.item(0).getChildNodes();
    System.out.println(nodeList1.getLength()+" node list "+nodeList1.item(0));
    System.out.println(nodeList1.item(0).getNodeValue());
    When I ran the above coding I got:
    1 node list [name: null]
    null
    1 node list [#text: name]
    name
    What should I do to get the result "john" inorder to change it
    Thanks
    rathi

    System.out.println(nodeList.item(0).getFirstChild().getNodeValue());

  • Error occured while inserting XML file data into table.

    Hello,
    I m trying to load xml data into table by following code.but getting below error
    Error at line 1
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00222: error received from SAX callback function
    ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
    ORA-06512: at line 21
    DECLARE
      xmldoc   clob;
      insCtx   DBMS_XMLStore.ctxType;
      dname    varchar2(20) := 'MDIR';
      rows  number;
    BEGIN
        xmldoc := dbms_xslprocessor.read2clob(dname, 'try_xm3.xml');
        insCtx := DBMS_XMLStore.newContext('try1');
    dbms_output.put_line('1');
        DBMS_XMLStore.setRowTag(insCtx, 'cajas');
    rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
    commit;
      dbms_output.put_line('INSERT DONE '||TO_CHAR(rows));
      DBMS_XMLStore.closeContext(insCtx);
    END;
    <?xml version="1.0" encoding="utf-8"?>
    <cajas xmlns="PBcion.Caja" fec="2011-03-02T14:20:14" codDeleg="093">
      <caj codPrev="80001223" fechaInicio="2011-03-02" fec="2011-09-02" couta="01" idPerio="1" caj="32"></caj>
    </cajas>can you please look into this?
    I m using oracle 10g

    SQL> create table try1
      2  (
      3  codPrev number,
      4  fechaInicio varchar2(25),
      5  fec varchar2(25),
      6  couta number,
      7  idPerio number,
      8  caj number
      9  );
    Table created
    SQL>
    SQL> insert into try1 (codprev, fechainicio, fec, couta, idperio, caj)
      2  select x.codprev, x.fechainicio, x.fec, x.couta, x.idperio, x.caj
      3  from xmltable(
      4         xmlnamespaces(default 'PBcion.Caja')
      5       , '/cajas/caj'
      6         passing xmltype(bfilename('TEST_DIR','try_xm3.xml'), nls_charset_id('AL32UTF8'))
      7         columns codPrev     number       path '@codPrev'
      8               , fechaInicio varchar2(25) path '@fechaInicio'
      9               , fec         varchar2(25) path '@fec'
    10               , couta       number       path '@couta'
    11               , idPerio     number       path '@idPerio'
    12               , caj         number       path '@caj'
    13       ) x
    14  ;
    1 row inserted
    SQL> select * from try1;
       CODPREV FECHAINICIO               FEC                            COUTA    IDPERIO        CAJ
      80001223 2011-03-02                2011-09-02                         1          1         32
    Since the two date attributes are coming in the W3C's xs:date format, you can directly define the corresponding columns as DATE and use a DATE projection in XMLTable :
    SQL> alter table try1 modify (fechainicio date);
    Table altered
    SQL> alter table try1 modify (fec date);
    Table altered
    SQL>
    SQL> insert into try1 (codprev, fechainicio, fec, couta, idperio, caj)
      2  select x.codprev, x.fechainicio, x.fec, x.couta, x.idperio, x.caj
      3  from xmltable(
      4         xmlnamespaces(default 'PBcion.Caja')
      5       , '/cajas/caj'
      6         passing xmltype(bfilename('TEST_DIR','try_xm3.xml'), nls_charset_id('AL32UTF8'))
      7         columns codPrev     number       path '@codPrev'
      8               , fechaInicio date         path '@fechaInicio'
      9               , fec         date         path '@fec'
    10               , couta       number       path '@couta'
    11               , idPerio     number       path '@idPerio'
    12               , caj         number       path '@caj'
    13       ) x
    14  ;
    1 row inserted
    SQL> select * from try1;
       CODPREV FECHAINICIO FEC              COUTA    IDPERIO        CAJ
      80001223 02/03/2011  02/09/2011           1          1         32

  • Error while uploading .xml file for Customer/Vendor List for Italy

    Hi All,
    We are facing problem while uploading the .xml file in DMEE transaction for the new Customer/Vendor List for Italy.
    We have followed the entire process given in the OSS Note(1090857).
    We have SAP 4.6c and followed the below steps:
    1. Created ID-FI-IT Development class
    2. Added domains
    3. Added Data elements
    4. Tried to upload the given .xml file and got any error saying ".xml file could not be interpreted".
    Also there is a .SAR file mentioned to upload if we receive any errors while uploading .xml file.
    Tried uploading the .SAR file also. STill we are recieving the same Error.
    Can any one of you help us out.
    Thanks in Advance.
    Ramesh

    Ok, we upload .SAR file in this way:
    1. unpack .SAR file with SAPCAR.EXE program. Yuo obtain 2 files
    R492445.P9C and K492445.P9C
    2. put K492445.P9C in directory \SAPMNT\TRANS\COFILES and put R492445.P9C in directory \SAPMNT\TRANS\DATA of your system (DEV, TST or PRD)
    3. Use Tx STMS. If You want create DMEE tree in DEV system, go to DEV import queue. Choose menu Extras | Other requests | Add. Insert P9CK492445 in Transp. request field.
    4. Import the request. This creates the DMEE tree. You don't need ti upload XML file after. You can see the DMEE tree created with Tx DMEE and inserting
    Tree type        UMS1            
    Format tree     IT_CUST_VEN_LIST
    5. after continue follow the note
    I hope this help you
    Roberto

  • Problem while inserting into a table which has ManyToOne relation

    Problem while inserting into a table *(Files)* which has ManyToOne relation with another table *(Folder)* involving a attribute both in primary key as well as in foreign key in JPA 1.0.
    Relevent Code
    Entities:
    public class Files implements Serializable {
    @EmbeddedId
    protected FilesPK filesPK;
    private String filename;
    @JoinColumns({
    @JoinColumn(name = "folder_id", referencedColumnName = "folder_id"),
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Folders folders;
    public class FilesPK implements Serializable {
    private int fileId;
    private int uid;
    public class Folders implements Serializable {
    @EmbeddedId
    protected FoldersPK foldersPK;
    private String folderName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "folders")
    private Collection<Files> filesCollection;
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Users users;
    public class FoldersPK implements Serializable {
    private int folderId;
    private int uid;
    public class Users implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer uid;
    private String username;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
    private Collection<Folders> foldersCollection;
    I left out @Basic & @Column annotations for sake of less code.
    EJB method
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    FoldersPK folderPk = new FoldersPK(folderID, uid);
         // My understanding that it should automatically handle folderId in files table,
    // but it is not…
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    It is giving error:
    Internal Exception: java.sql.SQLException: Field 'folderid' doesn't have a default value_
    Error Code: 1364
    Call: INSERT INTO files (filename, uid, fileid) VALUES (?, ?, ?)_
    _       bind => [hello.txt, 1, 0]_
    It is not even considering folderId while inserting into db.
    However it works fine when I add folderId variable in Files entity and changed insertFile like this:
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    file.setFolderId(folderId) // added line
    FoldersPK folderPk = new FoldersPK(folderID, uid);
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    My question is that is this behavior expected or it is a bug.
    Is it required to add "column_name" variable separately even when an entity has reference to ManyToOne mapping foreign Entity ?
    I used Mysql 5.1 for database, then generate entities using toplink, JPA 1.0, glassfish v2.1.
    I've also tested this using eclipselink and got same error.
    Please provide some pointers.
    Thanks

    Hello,
    What version of EclipseLink did you try? This looks like bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280436 that was fixed in EclipseLink 2.0, so please try a later version.
    You can also try working around the problem by making both fields writable through the reference mapping.
    Best Regards,
    Chris

  • Error while loading xml files using JDBC

    Hi,
    I am trying to load xml files into an xmltype table using JDBC calls and am getting this error for some files
    LPX-00200: could not convert from encoding UTF-8 to UCS2
    The xml files and our database are both UTF-8 encoded. The version of oracle that we have here is 9.2.0.6
    Any suggestions in this matter will be greatly appreciated.
    Thanks,
    Uma

    I also experienced this problem and unfortunately this solution didn't work for me given that the tag you suggested was already on the XML file.

  • Error while retreiving xml file from database

    Hi-
    I am trying to configure Planning and getting the following error message at instance configuration step:
    "Error while retreiving xml file from database"
    We looked at PlanningSystemDB.properties, changes server name to its ip, reinstalled planning, made sure both auth methods are selected (sql server and windows), created new relational repository.. still the same error.
    Here is the contents of the configtool error file:
    (Dec 11, 2008, 04:36:44 PM), com.hyperion.planning.PIRegistrationPanelManager, ERROR, Exception :Error while retreiving xml file from database.
    (Dec 11, 2008, 04:37:09 PM), com.hyperion.planning.PIRegistrationPanelManager, ERROR, Exception :Error while retreiving xml file from database.
    (Dec 11, 2008, 04:38:41 PM), com.hyperion.planning.PIRegistrationPanelManager, ERROR, Exception :Error while retreiving xml file from database.
    (Dec 11, 2008, 04:39:07 PM), com.hyperion.planning.PIRegistrationPanelManager, ERROR, Exception :Error while retreiving xml file from database.
    (Dec 11, 2008, 04:39:12 PM), com.hyperion.planning.PIRegistrationPanelManager, ERROR, Exception :Error while retreiving xml file from database.
    (Dec 11, 2008, 04:39:22 PM), com.hyperion.planning.PIRegistrationPanelManager, ERROR, Exception :Error while retreiving xml file from database.
    (Dec 11, 2008, 04:40:46 PM), com.hyperion.cis.config.CmsRegistrationUtil, ERROR, Failed to authenticate user = admin
    (Dec 11, 2008, 04:41:05 PM), com.hyperion.cis.config.CmsRegistrationUtil, ERROR, Failed to authenticate user = admin
    (Dec 11, 2008, 04:48:28 PM), com.hyperion.cis.DBConfigurator, ERROR, Invalid SQL statement: begin transaction IF EXISTS (select * from sysobjects where id = object_id(N'[HSPSYS_PROPERTIES]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE HSPSYS_PROPERTIES IF EXISTS (select * from sysobjects where id = object_id(N'[HSPSYS_APP_CLUSTER_DTL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE HSPSYS_APP_CLUSTER_DTL IF EXISTS (select * from sysobjects where id = object_id(N'[HSPSYS_APPLICATION]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE HSPSYS_APPLICATION IF EXISTS (select * from sysobjects where id = object_id(N'[HSPSYS_DATASOURCE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE HSPSYS_DATASOURCE IF EXISTS (select * from sysobjects where id = object_id(N'[HSPSYS_CLUSTER]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE HSPSYS_CLUSTER IF EXISTS (select * from sysobjects where id = object_id(N'[HSP_ACTION]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE HSP_ACTION IF EXISTS (select * from sysobjects where id = object_id(N'[HSPSYS_PI_INFO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE HSPSYS_PI_INFO commit begin transaction CREATE TABLE HSP_ACTION ( ID INTEGER NOT NULL IDENTITY, CONSTRAINT PK_HSP_ACTION PRIMARY KEY(ID) , FROM_ID INTEGER, TO_ID INTEGER, ACTION_ID INTEGER, OBJECT_TYPE INTEGER, PRIMARY_KEY VARCHAR(255), ACTION_TIME DATETIME ); CREATE TABLE HSPSYS_CLUSTER ( CLUSTER_ID INTEGER NOT NULL, NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), CONSTRAINT PK_HSPCLUSTER PRIMARY KEY(CLUSTER_ID) ); CREATE TABLE HSPSYS_DATASOURCE ( DATASOURCE_ID INTEGER NOT NULL, NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), APP_ID INTEGER, RDB_SERVER_URL VARCHAR(255), RDB_TYPE VARCHAR(255) NOT NULL, RDB_CATALOG_NAME VARCHAR(255) NOT NULL, RDB_USER VARCHAR(255) NOT NULL, RDB_PASSWORD VARCHAR(255), RDB_DRIVER VARCHAR(255) NOT NULL, ESS_SERVER VARCHAR(255) NOT NULL, ESS_USER VARCHAR(255) NOT NULL, ESS_PASSWORD VARCHAR(255), CONSTRAINT PK_HSPDTASRC PRIMARY KEY(DATASOURCE_ID) ); CREATE TABLE HSPSYS_APPLICATION ( APP_ID INTEGER NOT NULL, NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), DATASOURCE_ID INTEGER NOT NULL, CONSTRAINT FK_HSPAPP_DSID FOREIGN KEY(DATASOURCE_ID) REFERENCES HSPSYS_DATASOURCE, VERSION VARCHAR(255) NOT NULL, CONSTRAINT PK_HSPAPP PRIMARY KEY(APP_ID) ); CREATE TABLE HSPSYS_APP_CLUSTER_DTL ( APP_ID INTEGER NOT NULL , CONSTRAINT FK_HSP_APP_ID FOREIGN KEY (APP_ID) REFERENCES HSPSYS_APPLICATION , CLUSTER_ID INTEGER NOT NULL, CONSTRAINT FK_HSPCS_CLID FOREIGN KEY(CLUSTER_ID) REFERENCES HSPSYS_CLUSTER, CONSTRAINT PK_APP_CLSTR_DTL PRIMARY KEY(CLUSTER_ID, APP_ID) ); CREATE TABLE HSPSYS_PROPERTIES ( PROPERTY_ID INTEGER NOT NULL, OBJECT_ID INTEGER NOT NULL, PROPERTY_NAME VARCHAR(255) NOT NULL, PROPERTY_VALUE VARCHAR(255), CONSTRAINT PK_HSPPROP PRIMARY KEY(PROPERTY_ID, OBJECT_ID, PROPERTY_NAME) ); CREATE TABLE HSPSYS_PI_INFO ( XML_FILE NTEXT NOT NULL ); commit
    (Dec 11, 2008, 04:50:32 PM), com.hyperion.planning.PIRegistrationPanelManager, ERROR, Exception :Error while retreiving xml file from database.
    Thanks for any help.

    After spending 2+ hrs with Hyperion Support nothing got resolved.. Just to give more background on this problem, we originally reconfigured all Hyperion components to use different SQL server, that is when the problem started happening as soon as we got to Planning Instance Configuration. Could this be the situations when old server name is still somewhere in the system?.. Could this be Shared Services problem.
    Here is another quote from SharedServices_Security.log
    2008-12-12 15:08:48,249 [http-58080-Processor1] WARN com.hyperion.css.spi.impl.nv.NativeProvider.getHierarchicalRoleTree(Unknown Source) - Exception getting Child Roles in hierarchy due to Illegal or invalid id.dflt passed in. Please check the argument.
    2008-12-12 15:31:18,121 [main] WARN com.hyperion.css.common.configuration.CSSConfigurationImplXML.<init>(Unknown Source) - Skipping the validation of the configuration because the required validating parser library not found or errors in validation. This does not guarantee the proper initialization of the component.
    2008-12-12 15:31:29,808 [Thread-8] WARN com.hyperion.css.spi.impl.msad.MSADCacheUpdater.resolveCircularDependency(Unknown Source) - INFO: Time to resolve circular dependency on the Cache for provider: DIPORTAL is : 0
    2008-12-12 15:31:29,808 [Thread-8] WARN com.hyperion.css.spi.impl.msad.MSADCacheUpdater.refreshProviderCache(Unknown Source) - INFO: Time to build Cache for provider: DIPORTAL in millis is : 1016
    2008-12-12 15:31:30,823 [main] WARN com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - The system has already been configured; skipping attempt to configure the system again with the new config file /F:/Hyperion/deployments/Tomcat5/SharedServices9/config/CSS.xml.
    2008-12-12 15:31:41,229 [http-58080-Processor4] ERROR com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - Unable to get CSS.xml file or the file may be read only
    2008-12-12 15:31:41,229 [http-58080-Processor4] WARN com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - The system has already been configured; skipping attempt to configure the system again with the new config file /null.
    2008-12-12 15:38:01,938 [main] WARN com.hyperion.css.common.configuration.CSSConfigurationImplXML.<init>(Unknown Source) - Skipping the validation of the configuration because the required validating parser library not found or errors in validation. This does not guarantee the proper initialization of the component.
    2008-12-12 15:38:13,454 [Thread-8] WARN com.hyperion.css.spi.impl.msad.MSADCacheUpdater.resolveCircularDependency(Unknown Source) - INFO: Time to resolve circular dependency on the Cache for provider: DIPORTAL is : 0
    2008-12-12 15:38:13,454 [Thread-8] WARN com.hyperion.css.spi.impl.msad.MSADCacheUpdater.refreshProviderCache(Unknown Source) - INFO: Time to build Cache for provider: DIPORTAL in millis is : 813
    2008-12-12 15:38:35,453 [main] WARN com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - The system has already been configured; skipping attempt to configure the system again with the new config file /F:/Hyperion/deployments/Tomcat5/SharedServices9/config/CSS.xml.
    2008-12-12 15:42:09,776 [http-58080-Processor3] ERROR com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - Unable to get CSS.xml file or the file may be read only
    2008-12-12 15:42:09,776 [http-58080-Processor3] WARN com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - The system has already been configured; skipping attempt to configure the system again with the new config file /null.
    2008-12-12 15:42:09,776 [http-58080-Processor2] ERROR com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - Unable to get CSS.xml file or the file may be read only
    2008-12-12 15:42:09,776 [http-58080-Processor2] WARN com.hyperion.css.CSSAPIImpl.initialize(Unknown Source) - The system has already been configured; skipping attempt to configure the system again with the new config file /null.

  • Product Instance Registration Error Message: "System Failure: Error while retrieving xml file from database"

    Hi Planning installation Gurus,
    Did u get any luck to resolve this problem as i am also facing same problem "Error creating instance" during install of Planning 9.3.1. i tried 30-50 times reconfiguration every time same problem..
    OS: Vista Premium
    SQL Server 2005
    Essbase:9.3.1
    Error Message: "System Failure: Error while retrieving xml file from database"
    Details of error:::::::::::::::::::::::::
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    java.lang.NullPointerException
    at com.hyperion.planning.sql.HspSQLImpl.getConnection(Unknown Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.actionPoller(Unkno
    wn Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    java.lang.NullPointerException
    at com.hyperion.planning.sql.HspSQLImpl.getConnection(Unknown Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.actionPoller(Unkno
    wn Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    Pls provide Solution

    Hi John,
    though i am trying with SQl server authentication with different user but still status is same of planningSystemDB.properties
    SYSTEM_DB_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    SYSTEM_DB_URL=jdbc:hyperion:sqlserver://neeraj-PC:1433
    SYSTEM_DB_USER=windowsAuthentication
    SYSTEM_DB_PASSWORD=CAFBAEFNBGEAABHEDOADFKADACBGBIFHBLCDFBAFFH
    SYSTEM_DB_CATALOG=plandb
    SYSTEM_DB_TYPE=SQL
    INSTANCE=
    my steps:
    Using SQL Server Management Studio
    Changed Widows authentication to SQL server authentication mode
    In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
    On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
    In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
    In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
    On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
    In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
    To restart SQL Server from SQL Server Management Studio
    To enable the sa login by using Management Studio
    In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
    On the General page, you might have to create and confirm a password for the sa login.
    On the Status page, in the Login section, click Enabled, and then click OK.
    In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
    On the General page, you might have to create and confirm a password for the sa login.
    On the Status page, in the Login section, click Enabled, and then click OK.}}}
    anything else should i change.................

  • Product Instance Registration Error: "System Failure: Error while retrieving xml file from database"

    Hi S9 installation Gurus,
    Please try to resolve this long awaited issue with Planning installation as this is purely configuration related issue.
    Detail of Problem:-
    After Susessful configuration of
    1) Foundation Services (Hyperion Shared Services)
    2) Essbase administration services
    3) Essbase Server
    4) Hyperion reporting and analysis
    5) Planning -----> Product options, Register with shared services, configure database, deploy to application server (Appache)
    Error Point: when i tick ckeck box in front of Product instance registration
    click next
    create instance
    click next
    instance name-Plan1
    Web tier host name: my machine name (neeraj-pc, as i installed locally all component of hyperion)
    server port: 8300 (system suggesting)
    tick on active instance
    click next
    Error Pop Up "System Failure: Error while retrieving xml file from database"
    Details of PlanningSystemDB (file :- \Hyperion\common\config\PlanningSystemDB.properties)
    SYSTEM_DB_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    SYSTEM_DB_URL=jdbc:hyperion:sqlserver://neeraj-PC:1433
    SYSTEM_DB_USER=puser
    SYSTEM_DB_PASSWORD=GGAKFJ
    SYSTEM_DB_CATALOG=p1db
    SYSTEM_DB_TYPE=SQL
    INSTANCE=
    Note: puser (SQL Authenticated user)
    Thanks
    Kumar
    Edited by: user10385300 on Dec 4, 2008 5:44 AM

    This has been resolved at :- Product Instance Registration Error Message: "System Failure: Error while retrieving xml file from database"
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • ORA-01000 during inserting xml files

    Hello,
    I'm using the following jdbc-code to insert xml files into oracle 10gRelease2:
    PreparedStatement stmt = null;
    Connection conn = getConnection();
    try
    stmt = conn.prepareStatement("insert into security values (?)");
    } catch (Exception e) {
    System.err.println(e);
    BufferedInputStream bufferedInputStream;
    for (int i = 1; i < 500; i++)
    String docName = "../../../data/output/security/security" + i+ ".xml";
    try
    FileInputStream fileInputStream = new FileInputStream(docName);
    bufferedInputStream = new BufferedInputStream(fileInputStream, 5000);
    XMLType doc = null;
    doc = XMLType.createXML(conn, bufferedInputStream);
    stmt.setObject(1, doc);
    stmt.executeUpdate();
    doc.close();
    fileInputStream.close();
    } catch (Exception e) {
    System.out.println(i);
    System.err.println(e);
    conn.commit();
    The code is working fine when I insert less than 340 files. But when I try to insert more than 340 files I'm getting the error:
    java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    Where do I open so many cursors? During creating the XMLType?
    Thx,
    Fabian

    I can reproduce this. Looks like a problem with the XMLType.createXML() method. Will confirm and file a bug if necessary. In the mean time the following works and has the same effect
    package com.oracle.st.xmldb.pm.examples;
    import com.oracle.st.xmldb.pm.common.baseApp.BaseApplication;
    import java.io.ByteArrayInputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.Reader;
    import java.io.Writer;
    import java.sql.SQLException;
    import oracle.jdbc.OracleCallableStatement;
    import oracle.jdbc.OraclePreparedStatement;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.CLOB;
    import oracle.xdb.XMLType;
    public class BulkInsertXMLType extends BaseApplication
       public static String TABLE_NAME  = "Table";
       public static String SOURCE_FILE = "File";
       public static String ITERATIONS  = "Iterations";
       public void doSomething(String[] Args) throws Exception
          OracleCallableStatement  statement = null;
          String statementText;
          XMLType xml;
          CLOB    clob = CLOB.createTemporary( getConnection(), true, CLOB.DURATION_SESSION);
          // statementText = "insert into " + this.getSetting(this.TABLE_NAME) + " values(:1)";
          statementText = "insert into " + this.getSetting(this.TABLE_NAME) + " values(xmltype(:1))";
          System.out.println("GetXMLType.doSomething : Driver Type = " + this.getDriver() + ". Statement = " + statementText);
          statement = (OracleCallableStatement) getConnection().prepareCall(statementText);
          for (int i=0; i < Integer.parseInt(getSetting(this.ITERATIONS)); i++)
            try {
              InputStream is = new FileInputStream(getSetting(this.SOURCE_FILE));
              // xml = XMLType.createXML(this.getConnection(),is);            
              // statement.setObject(1,xml);
              InputStreamReader reader = new InputStreamReader( is );
              Writer writer = clob.setCharacterStream(0);
              char [] buffer = new char [ clob.getChunkSize() ];
              for( int charsRead = reader.read( buffer );
              charsRead > - 1;
              charsRead = reader.read( buffer ) )
                 writer.write( buffer, 0, charsRead );
              writer.close();
              reader.close();
              statement.setCLOB(1,clob);
              boolean result = statement.execute();
              is.close();
              clob.truncate(0);
            catch (SQLException sqle) {
                System.out.println("SQL Exception caught after " + i + "Iterations");
                System.out.println(sqle);
                throw sqle;
          CLOB.freeTemporary(clob);
          statement.close();
          getConnection().commit();
          getConnection().close();
      public static void main (String[] args)
        try
          BulkInsertXMLType example = new BulkInsertXMLType();
          example.initializeConnection();
          example.doSomething(args);
        catch (Exception e)
          e.printStackTrace();
    }

Maybe you are looking for

  • I need to unregister my

    I need to unregister my phone # from imessage. How?

  • How to set the iphone overseas to avoid data and phone charges

    Can someone tell me what settings to change on my iphone 4 to avoid email coming in and getting huge data charges when I travel overseas?? I still want to receive texts and use the phone when I choose to turn it on. Suzie

  • Space problem in Installation

    Hello All,                 I am in the middle of IDEAs Installation of ECC 6.0.Though I am having 300 GB of space till it is giving me error while creating the tablespaces.I am using HP-Unix & Oracle ERROR 2010-02-05 20:07:03.114 FCO-00011  The step

  • PATCH FOR CIN

    Dear Experts, I am not able to view the menu paths for J1ID,J2IUN etc....The menupath for "INDIRECT TAXES" is not reflecting in SAP EASY ACCESS menu...Kindly tell me the procedure..If any new pathches are to be added please explain me the concept to

  • My kids use firefox on my computer. Is it possible to disable the private browsing feature so they can not go on and use it ?

    I want the computer to keep a history of all the site they have searched, but can not know for sure if they turn on/off the private browsing function. Is it possible to disable the private browsing function and put a lock / password on it ? Thanks, D