5 Replies Latest reply on May 19, 2016 9:47 AM by shawkins

    Functions cascaded through multiple Teiid instances

    andreas.krueck

      I have an existing Teiid instance (Teiid 1) where a function is defined in the VDB like this:

       

      <model visible="true" name="MyModel">

           <source name="MySource" translator-name="oracle" connection-jndi-name="java:/My_Database_DS"/>

           <metadata type="DDL"><![CDATA[

                create foreign function my_function(field clob, pattern string) returns integer options (NAMEINSOURCE 'xxx');

           ]]>

           </metadata>

      </model>

       

       

      This works fine, but I want to add another Teiid 2 (Teiid 8.13.3 with WildFly) inbetween Teiid 1 and the Oracle DB, so I can do something like this:

       

      Teiid 2 VDB:

       

      <vdb name="My_Teiid2_VDB" version="1">

           <model visible="true" name="MyOracleModel">

                <source name="MySource" translator-name="oracle" connection-jndi-name="java:/My_Database_DS"/>

           </model>

      </vdb>

       

      Teiid 1 VDB:

       

      <model visible="true" name="MyModel">

           <source name="MyOracleModel" translator-name="teiid" connection-jndi-name="java:/My_Teiid2_VDB_DS"/>

           <metadata type="DDL"><![CDATA[

                create foreign function my_function(field clob, pattern string) returns integer options (NAMEINSOURCE 'xxx');

           ]]>

           </metadata>

      </model>

       

      I established the connection between the two Teiid instances with other data from the Oracle datasource, but I don*t know what setup is needed for creating the function.

      Any hint would be helpful.

        • 1. Re: Functions cascaded through multiple Teiid instances
          shawkins

          > I established the connection between the two Teiid instances with other data from the Oracle datasource, but I don*t know what setup is needed for creating the function.

           

          Since this is treating the intermediate vdb as a source, you would need to have the function declared in My_Teiid2_VDB

           

          <vdb name="My_Teiid2_VDB" version="1">

               <model visible="true" name="MyOracleModel">

                    <source name="MySource" translator-name="oracle" connection-jndi-name="java:/My_Database_DS"/>

                    <metadata type="NATIVE"/>

                    <metadata type="DDL"><![CDATA[

                             create foreign function my_function(field clob, pattern string) returns integer options (NAMEINSOURCE 'xxx');

                    ]]>

               </model>

          </vdb>

           

          You will still need the declaration in Teiid 1 VDB as the import logic does not yet import all functions.

          • 2. Re: Functions cascaded through multiple Teiid instances
            andreas.krueck

            Thanks,

             

            I defined the Teiid 2 VDB as described and got an error message (TEIID50036: Invalid arguments in call) when starting teiid.

            If I leave out the <metadata type="NATIVE"/>, it works.

             

            FYI, my Teiid 1 VDB looks like this now:

             

            <model visible="true" name="MyModel">

                 <source name="MySource" translator-name="teiid" connection-jndi-name="java:/My_Teiid2_VDB_DS"/>

                 <metadata type="DDL"><![CDATA[

                      create foreign function my_function(field clob, pattern string) returns integer options (NAMEINSOURCE 'my_function');

                 ]]>

                 </metadata>

            </model>

            • 3. Re: Functions cascaded through multiple Teiid instances
              shawkins

              > If I leave out the <metadata type="NATIVE"/>, it works.

               

              I was assuming that you wanted to import the source metadata, so I added that tag - but it looks like some of the import settings need set to narrow the import.  If you don't need the source metadata imported, then just removing the element is fine.

              • 4. Re: Functions cascaded through multiple Teiid instances
                rareddy

                Steve,

                 

                Do you think we need to further tune default import properties, may be based on particular translator being used? Seems like we are running into this more often.

                 

                Ramesh..

                • 5. Re: Functions cascaded through multiple Teiid instances
                  shawkins

                  They generally have been tuned as issues are found.  A new issue along with all of the specifics would need to be captured here.