Dynamicvdb-portfolio demonstrates how to use the File Translator to federate text file-based sources with
data from a relational database.  This example uses the HSQL database referenced as the DefaultDS data source in the server, 
but the creation SQL could be adapted to another database if you choose.


Database setup:

-	NOTE: Before starting the server, edit the bin/run.conf (if production configuration is used, the run.conf is in the production directory) and change -Djava.awt.headless=true to false.  This will enable the HSQL Database Manager from the JMX Console (SOA-906).
-	Start the server
-	go to the JMX console and select:   database=localDB,service=Hypersonic  
to present bean options.  Now invoke "startDatabaseManager" to bring up HSQL Database Manager.
-	Use the File/Open Script menu option to load the customer-schema.sql script and and then click Execute SQL to create the required tables and insert the example data.


Teiid Deployment:

Copy the following files to the <jboss.home>/server/default/deploy directory.
	- portfolio-vdb.xml
	- marketdata-file-ds.xml

Demonstration Queries:

The following instructions demonstrate the ability to federate the relational and text-file data sources.

==== Using the simpleclient example ====

1) Change your working directory to <your installation>/jboss-soa-p-5/eds/teiid/examples/simpleclient

2) If the default user account is not being used, then edit JDBCClient.java and specify a username and password for a
   valid user account.

3) Use the simpleclient example run script, using the following format

$./run.sh localhost 31000 weather "example query" 


example queries:

1	select * from product
2	select stock.* from (call MarketData.getTextFiles('*.txt')) f, TEXTTABLE(f.file COLUMNS symbol string, price bigdecimal HEADER) stock
3.	select product.symbol, stock.price, company_name from product, (call MarketData.getTextFiles('*.txt')) f, TEXTTABLE(f.file COLUMNS symbol string, price bigdecimal HEADER) stock where product.symbol=stock.symbol

Example 1 queries the relational source

Example 2 queries the text file-based source

Example 3 queries both the relational and the text file-based sources.  The files returned from the getTextFiles procedure are passed to the TEXTTABLE table function (via the nested table correlated reference f.file).  The TEXTTABLE function expects a text file with a HEADER containing entries for at least symbol and price columns. 


