Teiid embedded samples H2

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 H2 Database as data source, the architecture as below:



Mysql database be used in this example, note that test are mysql database name, it contain the customer-schema-h2.sql tables.

The customer-schema-h2.sql be executed automatically in runtime.


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, H2VDB has Model Product point to H2 database test

The completed content of H2VDB


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

init("translator-h2", new H2ExecutionFactory());
server.deployVDB(new FileInputStream(new File("vdb/h2-vdb.xml")));
conn = server.getDriver().connect("jdbc:teiid:H2VDB", null);

Completed Source code