-
1. Re: getting started with teiid
shawkins Oct 9, 2014 2:57 PM (in response to afrieden)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 Oct 9, 2014 3:27 PM (in response to afrieden)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 Oct 9, 2014 4:26 PM (in response to rareddy)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 Oct 9, 2014 4:52 PM (in response to afrieden)1 of 1 people found this helpfulAlex,
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..
-
5. Re: getting started with teiid
afrieden Oct 10, 2014 10:24 AM (in response to rareddy)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 Oct 10, 2014 10:44 AM (in response to afrieden)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 Oct 10, 2014 3:41 PM (in response to rareddy)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 Oct 10, 2014 4:40 PM (in response to afrieden)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 Oct 10, 2014 5:03 PM (in response to shawkins)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 Oct 10, 2014 7:27 PM (in response to afrieden)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 Oct 11, 2014 11:47 AM (in response to shawkins)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 Oct 11, 2014 4:08 PM (in response to afrieden)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