12 Replies Latest reply on Oct 11, 2014 4:08 PM by rareddy

    getting started with teiid

    afrieden

      Hi everyone,

      newcomer to jboss and teiid.  We are trying to have a way to connect our Mongodb data to our Oracle data. 

       

      We have jboss and teiid 8.4 installed on one of our servers.  I am able connect into it and access the admin console.  I want to add a VDB source next without the designer of just our mongodb data. 

       

      Should I just be editing the standalone-teiid.xml file with our schema?  Thanks!

        • 1. Re: getting started with teiid
          shawkins

          If you edit the standalone-teiid.xml it would be to add a data source that uses the MongoDB resource adapter.  From there the VDB will reference the data source and the mongodb translator as the source for a model/schema - see MongoDB Translator - Teiid 8.9 (draft) - Project Documentation Editor

          • 2. Re: getting started with teiid
            rareddy

            First of all I would not recommend any thing less then 8.8 or 8.9 Teiid to be used with MongoDB. We fixed many issues during these versions. The above link Steve suggests have good example as to how to create a Dynamic VDB to access the data in MongoDB. You would need to add similar model in the same VDB for Oracle, then any view layers on top. Look up Dynamic VDBs and DDL Metadata in documentation as to how to define the VDBs and their metadata.

            • 3. Re: getting started with teiid
              afrieden

              Thanks Ramesh!  Is there any walkthroughs of how to do from top to bottom?  Was going through the documentation and for instance not sure where vdb.xml needs to go from

              MongoDB Translator - Teiid 8.9 (draft) - Project Documentation Editor

              Thanks! 

              • 4. Re: getting started with teiid
                rareddy

                Alex,

                 

                If you are  new to Teiid, I suggest reading or walking through a quick start example like here Data Federation Example - Teiid Examples - Project Documentation Editor There is source for this also.


                If you want to use Designer, or just for fun you can take look at this Connect to a MongoDB Source that gives you a sense of what needs to be done.  Basically you are doing exactly same as in the Quick Start above, but replacing the File source with MongoDB

                 

                1) Configure your MongoDB source

                2) In the JBoss EAP create a resource-adapter connection (by editing standalone-teiid.xml file). There is sample in previous comment's link.

                3) Now create a Dynamic VDB (only XML, no Designer). Here you are creating a model and configuring the metadata of your model.

                4) Deploy VDB.  You can use web-console, JBoss CLI to do this, or copy the file into deployments directory and create marker .dodeploy file.

                5) If you successfully deployed, the VDB will be in the active state. If not you need to figure out why.

                6) Once active you can use any JDBC/ODBC or ODATA client to issue SQL queries against the MongoDB and Oracle as if they are single and SQL sources.

                 

                It takes about 30-60 mins get your head around for the first example, after that it should seem relatively easy.

                 

                Ramesh..

                1 of 1 people found this helpful
                • 5. Re: getting started with teiid
                  afrieden

                  Thanks!  Very helpful! 

                  Not sure what you mean by step 1, if you mean set up a mongodb database and get it running I have already done that. 

                  In step 3, am I just creating a vdb.xml like in https://docs.jboss.org/author/display/TEIID/MongoDB+Translator?

                  If so, where do I place the vdb.xml file?

                  • 6. Re: getting started with teiid
                    rareddy

                    Yes. The vdb.xml file needs to be in the format like "mongodb-vdb.xml", here "-vdb.xml" postfix is important. Once you have the XML file, there are multiple options to deploy

                     

                    1) copy to "standalone/deployments" folder, and also create "mongodb-vdb.xml.dodeploy" marker file

                     

                    2) You web-console, http://localhost:8080, it should give options to deploy a file

                     

                    3) run <jboss-eap/bin>/jboss-cli.sh, then issue command like below

                    deploy mongodb-vdb.xml

                     

                    You only need one of those three, once you deploy make sure the in console it says it is deployed and is ACTIVE. Once it is active you connect to the VDB using any SQL client program.

                     

                    Ramesh..

                    • 7. Re: getting started with teiid
                      afrieden

                      okay, deployed but getting the following error:

                      deploy /opt/jboss-eap-6.1/standalone/deployments/mongodb-vdb.xml

                      {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"mongodb-vdb.xml\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"mongodb-vdb.xml\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"mongodb-vdb.xml\"

                          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: TEIID50017

                          Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'model' cannot have character [children], because the type's content type is element-only."}}}}

                       

                       

                      for my mongodb-vdb.xml:

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

                          <model name="vcf">

                              <source name="vcf" translator-name="mongodb" connection-jndi-name="java:/mongoDS"/>

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

                                      CREATE FOREIGN TABLE  Record (

                                          record_id integer,

                                          position integer,

                                          contig varchar(25),

                                          reference varchar(100),

                                          alternate varchar(100),

                                          variant boolean,

                                          ordered boolean,

                                          version varchar(100)

                                      ) OPTIONS(UPDATABLE 'TRUE');

                                  ]]> </metadata>

                          </model>

                      <vdb>

                       

                      Any thoughts?

                      • 8. Re: getting started with teiid
                        shawkins

                        It looks like the ending vdb tag is not correct - should be </vdb>

                         

                        I'm not sure why the xml parser would give such an unclear error though.

                        • 9. Re: getting started with teiid
                          afrieden

                          Fixed that but still getting an error

                          mongodb-vdb.xml

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

                              <model name="vcf">

                                  <source name="vcf" translator-name="mongodb" connection-jndi-name="java:/mongoDS"/>

                                      <metadata type="DDL">

                            <![CDATA[

                                          CREATE FOREIGN TABLE  Record (

                                              record_id integer,

                                              position integer,

                                              contig varchar(25),

                               reference varchar(100),

                               alternate varchar(100),

                               variant boolean,

                               ordered boolean,

                               version varchar(100)

                                          ) OPTIONS(UPDATABLE 'TRUE');

                                      ]]>

                            </metadata>

                              </model>

                          </vdb>

                           

                          error:

                          {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"mongodb-vdb.xml\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"mongodb-vdb.xml\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"mongodb-vdb.xml\"

                              Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: TEIID50017

                              Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'model' cannot have character [children], because the type's content type is element-only."}}}}

                           

                          standalone-teiid.xml

                          ...

                          <resource-adapter id="mongodb">

                                              <module slot="main" id="org.jboss.teiid.resource-adapter.mongodb"/>

                                              <transaction-support>NoTransaction</transaction-support>

                                              <connection-definitions>

                                                  <connection-definition class-name="org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory"

                                                          jndi-name="java:/mongoDS"

                                                          enabled="true"

                                                          use-java-context="true"

                                                          pool-name="teiid-mongodb-ds">

                           

                           

                                            <!-- MongoDB server list (host:port[;host:port...]) -->

                                            <config-property name="RemoteServerList">10.200.128.24:27017</config-property>

                                            <!-- Database Name in the MongoDB -->

                                            <config-property name="Database">vcf</config-property>

                                              <!--

                                                  Uncomment these properties to supply user name and password

                                              <config-property name="Username">user</config-property>

                                              <config-property name="Password">user</config-property>

                                              -->

                                                  </connection-definition>

                                              </connection-definitions>

                                          </resource-adapter>

                                      </resource-adapters>

                          ...

                           

                          Any thoughts?

                          • 10. Re: getting started with teiid
                            shawkins

                            You must have a non-whitespace character under the model element that is not in child elements.  Perhaps in the log there is a full stack trace that includes the line and column number.

                            • 11. Re: getting started with teiid
                              afrieden

                              Thanks seemed to have worked and it is my active deployments.  Does that mean it is now a VDB?

                              • 12. Re: getting started with teiid
                                rareddy

                                Yes, now you can connect to it using JDBC/ODBC client of your choice, or write one. Follow Connecting to a Teiid Server - Teiid 8.9 (draft) - Project Documentation Editor