1 Reply Latest reply on Aug 17, 2016 7:07 AM by Ramesh Reddy

    Issue while added more than one model in VDB

    Kulbhushan Chaskar Master

      I want to execute native quires on database, for that I have deploy below model separately and i am able to deploy and able to execute queries as well.

      1.  For my sql

      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <vdb name="PrePostMySql" version="1">
      <description/>
           <model name="nativeVersion">
                <source connection-jndi-name="java:/MySqlDSTest1" name="nativeVersion" translator-name="mySql-native"/>
           </model>
           <translator name="mySql-native" type="mysql">
                <property name="SupportsDirectQueryProcedure" value="true"/>
           </translator>
      </vdb>
      

      2. For ORACLE

      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <vdb name="prePostSql" version="1">
      <description/>
           <model name="nativeVersion">
                <property name="importer.schemaPattern" value="TEST"/>
                <source connection-jndi-name="java:/OracleDS" name="nativeVersion" translator-name="oracle-native"/>
           </model>
           <translator name="oracle-native" type="oracle">
                <property name="SupportsDirectQueryProcedure" value="true"/>
           </translator>
      </vdb>
      

      But when I add two model which use a translator having "SupportsDirectQueryProcedure" as true. I am getting error.  VDB as

       

      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <vdb name="PrePostMySqlOracle" version="1">
      <description/>
           <model name="nativeVersion1">
                <property name="importer.schemaPattern" value="TEST"/>
                     <source connection-jndi-name="java:/OracleDS" name="nativeVersion1" translator-name="oracle-native"/>
           </model>
           <translator name="oracle-native" type="oracle"><property name="SupportsDirectQueryProcedure" value="true"/>
           </translator>
           <model name="nativeVersion2">
                <source connection-jndi-name="java:/MySqlDSTest1" name="nativeVersion2" translator-name="mySql-native"/>
           </model>
           <translator name="mySql-native" type="mysql"><property name="SupportsDirectQueryProcedure" value="true"/>
           </translator>
      </vdb>
      

      It gives error as

       

      Caused by: org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 30; cvc-complex-type.2.4.a: Invalid content was found starting with element 'model'. One of '{translator, data-role, entry}' is expected.

        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)

       

      As per the error; it looks like it search one of the property from {translator, data-role, entry}. but I already provide a "translator-name="mySql-native" property.

       

      I have tried by changing a sequence of models in VDB file. it every time showing same error for second model.(the model present at 2 position in VDB file)

       

      My concern is "add multiple models in single VDB from which I can execute a native query in respective database".

       

      Please guide me.