Teiid embedded samples MongoDB

Teiid Embedded is a light-weight version of Teiid, it contain an easy-to-use JDBC Driver that can embed the Query Engine in any Java application. The Embedded mode supply almost all Teiid features without JEE Container involved, it supply a convenient way for Users who want integrate Teiid with their Application.

This document show how Teiid Embedded use MongoDB as data source, the architecture as below:



MongoDB run remotely, in this example, MongoDB run on, with database mydb.

nothwind VDB

A Virtual Database (VDB) is an artifact that defines the logical schema model combining one or more physical data sources to provide easy data integration. In this example, nothwind VDB has Model northwind point to MongoDB database mydb.

The completed content of northwind VDB


Java Application run on JVM, load the northwind VDB and query via JDBC. The mainly Code Snippets:

init("translator-mongodb", new MongoDBExecutionFactory());
MongoDBManagedConnectionFactory managedconnectionFactory = new MongoDBManagedConnectionFactory();
server.addConnectionFactory("java:/mongoDS", managedconnectionFactory.createConnectionFactory());
server.deployVDB(new FileInputStream(new File("vdb/mongodb-vdb.xml")));
conn = server.getDriver().connect("jdbc:teiid:nothwind", null);

Completed Source code