Teiid embedded samples Files
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 Files(flat/xml file) as data source, and query files data via Teiid Driver with JDBC, the architecture as below:
Files
Two files be used in this example:
FilesVDB
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, FilesVDB has Stocks
point to marketdata.csv, and Books
for books.xml
The completed content of FilesVDB
JVM
Java Application run on JVM, load the FilesVDB
and query via JDBC. The mainly Code Snippets:
init("file", new FileExecutionFactory());
FileManagedConnectionFactory managedconnectionFactory = new FileManagedConnectionFactory();
managedconnectionFactory.setParentDirectory("metadata");
server.addConnectionFactory("java:/marketdata-file", managedconnectionFactory.createConnectionFactory());
start(false);
server.deployVDB(new FileInputStream(new File("vdb/files-vdb.xml")));
conn = server.getDriver().connect("jdbc:teiid:FilesVDB", null);