This article provides a Teiid Designer 8.0 Quick Start example. In the example, you wil
- Create a relational model by importing JDBC Metadata into Designer
- Create a virtual database (VDB) from the model.
- Deploy the VDB and execute SQL queries via a JDBC connection to the VDB.
Pre-requisites: You must have at least one JDBC data source available including driver jars, URL and all other necessary connection information.
Install JBoss AS, Teiid & Teiid Designer
Install Teiid per the Teiid Installation Guide
Launch Teiid Server
- Open a terminal window on your computer, then navigate to the "<INSTALLDIR>/jboss-as-7.1.1.Final/bin" directory.
- Start the server with ./standalone.sh --server-config=standalone-teiid.xml
- Install Teiid Designer 8.0
- Installation of Designer 8.0 has changed slightly. See the What's New article for installation instructions.
Designer
If you don't have a database with schema and data defined, you can download the Parts Example and import into your workspace via "Import > General > Existing Projects into Workspace" and choose the "Select as archive file" option. This example comes with a readme.html to guide you through the database set-up steps as well as some of the steps described below.
Create Relational Model
Launch Eclipse, open the “Teiid Designer” perspective and create New > Teiid Model Project
Select “File >Import” . Under Teiid Designer, select the “JDBC Database >> Source Model” option
Select the “New...” button next to Connection Profile to launch the New Connection Profile (CP) wizard (DTP).
Note: you can also create CP's in DTP's Database Development Perspective. This perspective is also where you will create Teiid JDBC Source connections to your VDB's in order to run queries.
Each CP will required setting selecting the “Driver” jar(s). They should be the same jars you dropped into Teiid's install “/lib” folder during Teiid installation.
When you define the Connection Profile, you will need to define the driver jars to be used. After creating the Connection Profile, click “Next” and follow the wizard steps to complete the import.
Upon completion of the import, the generated model will include the connection profile properties used during import.
Note: You can change the model's connection profile info at any time, by selecting the model - then right-click “Modeling > Set Connection Profile”
Create Teiid server Instance
Open the Teiid view, the click the New link next to JBoss Server
- In the "New Teiid Instance" wizard, specify a Display Name for the Teiid server.
- Next to JBoss Server, click New..., then select JBoss Community > JBoss AS 7.1 from the list of server options. Click Next
- On the JBoss Runtime page, click the Browse... button in the Home Directory section. Select the directory where you installed the JBoss AS 7.1 server.
- Click the Browse... button next to Configuration file: Select the standalone-teiid.xml file from the configuration directory of your server installation. Complete the wizard.
- Back in the "New Teiid Instance" wizard page, enter the Teiid JDBC Connection Info
- User Name (default = "user")
- Password (default = "user")
- Teiid Template (JDBC URL Template = "jdbc:teiid:<vdbname>@mm://localhost:31000")
- This connection info will be used to set up JDBC connections to perform JDBC data queries to VDB's deployed on your Teiid server instance.
Click Finish to complete the wizard.
- Start the JBoss Server. If the Servers View is not open, then open it via Window > Show View > Other... > Server > Servers. Click the 'play' button on the toolbar to start the server.
The Teiid View should contain your new Teiid server instance.
The Teiid view default contents will include any VDB's deployed to this server instance and any of your specific “workspace” Data Sources.
Data Sources are the “JCA-compatible Connection Factory” xml configuration components required for Teiid to create the necessary connections to query data at run-time.
- If the Teiid Server View is not already open, open the Servers View. Then click on Teiid Server Configuration node and Rt-Click > Teiid Server Properties to open the Teiid Server View. On the Teiid Server View, test the server connection:
- Click the Test Administration Connection link to verify the admin connection. It should respond with 'OK'.
- Click the Test JDBC Connection link to verify the JDBC connection. It should respond with 'OK'.
Preview your data
Though your final deployable artifacts will be VDBs containing your modeled metadata, you can preview your data through your models without creating VDBs. To preview data:
- Select a table or procedure in a relational model in the Model Explorer
- Right-click select the "Modeling > Preview Data" action (or select the running man in the Model Explorer toolbar)
- Results are displayed in the SQL Results view provided by the Data Tools framework.
Create VDB
Select a Relational Model and choose “New > Teiid VDB”
This will automatically add the Model to the VDB
Enter a Name for the VDB, then click Finish.
VDB Editor opens and should contain your model. If the model is not contained, go ahead and add it.
The VDB Editor should have one row in the top table and have the “Translator” and “JNDI Name” columns populated.
If the Translator column is empty, enter an appropriate name from your Teiid view reflecting the DB your imported from (“oracle”, “sqlserver”, “derby”, etc..) or select table row for model and right-click select the “Change Translator” action. This will display a simple tree view of your servers containing available Translators. Select a Translator and hit OK.
If the JNDI Name column is empty, you will need to supply a valid JNDI Name for a Data Source (Connection Factory) on the server you wish to deploy your VDB to.
If you used the “Create Data Source” option for your local Teiid and chose the default model name, the JNDI name should be set to this same default value.
If you customized your data source name, select the table row for the source model and right-click select “Change JNDI Data Source” action. Select the appropriate Data Source and hit OK.
Save the VDB
Execute VDB
Select VDB in Model Explorer and right-click select "Modeling > Execute VDB" action.
- This action should result in the VDB being deployed to your default server and a connection profile created/opened in the Eclipse Database Development perpective.
- Note: This action will deploy the VDB to the “Default” server. If you have more than one server, the user is required to keep only one of the servers as the Default. You can change it by selecting a non-default Teiid server and right-click select “Set As Default” action.
- This action should result in the VDB being deployed to your default server and a connection profile created/opened in the Eclipse Database Development perpective.
- A SQL Scrapbook editor will be opened displaying instructions on executing a query.
- In the scrapbook, type in a query - for example: SELECT * FROM MyModel.Table. Put your cursor in the query text, then Rt-Click> Execute Current Text . The query will execute and display results in the SQL Results View.
This completes the Teiid Designer Quick Start!
Comments