Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

15.3. Testing With Your VDB

15.3.1. Testing With Your VDB

In Teiid Designer you can execute a VDB to test/query actual data.
The requirements for VDB execution are:
  • A deployed VDB backed by valid deployed Data Sources
  • An instance of a Teiid Connection Profile configured for the deployed VDB
Teiid Designer simplifies this process via Deploy VDB and Execute VDB actions. Deploy VDB does just that, deploy a selected VDB to a running Teiid instance. Execute VDB performs the VDB deployment, creates a Teiid Connection Profile, opens the Database Development perspective and creates a connection to your VDB.

15.3.2. Creating Data Sources

The mechanism by which VDBs are able to query actual data sources is the Data Source. These are deployed configurations backed by database or source connection jars. Each source model referenced within a VDB requires a JNDI name representing a deployed Data Source.
When creating VDBs you do not need to have deployed data sources on your JBoss Data Virtualization server, but if you wish to test your VDB, the data sources need to be present.
Teiid Designer provides a Create Data Source action so you can create compatible data sources for your source model. If you wish to create a data source for a specific model you can select that source model in your workspace and select the Modeling > Create Data Source action. This will extract the connection profile data from your source model and create a corresponding data source on your default JBoss Data Virtualization server.
You can also create data sources from the Server view. Select a JBoss Data Virtualization server instance in the Server view and right-click select the Create Data Source action. This will launch the Create Data Source dialog.
Create Data Source Dialog

Figure 15.10. Create Data Source Dialog

You can either select and existing Connection Profile from the drop-down list (Use Connection Profile Info option) or check the Use Model Info option and select an existing source model containing connection info.
After creating your new data source it should now be shown in the Data Sources folder of the corresponding JBoss Data Virtualization server.

15.3.3. Execute VDB from Model Explorer

If you have a JBoss Data Virtualization instance defined and connected in your Server view you can:
  1. Right-click a VDB in your Model Explorer select Modeling > Execute VDB action. This action will insure your selected VDB is deployed to JBoss Data Virtualization, create a Teiid Connection Profile specific for that VDB, open the Database Development perspective and create a connection to your VDB.
    Execute VDB Action

    Figure 15.11. Execute VDB Action

  2. Select your new Teiid connection profile and right-click select Open SQL Scrapbook, enter your designer SQL (i.e. SELECT * FROM TableXXXX), select all text and right-click select Execute Selected Text.
    SQL Scrapbook Editor

    Figure 15.12. SQL Scrapbook Editor

  3. Results of query should be displayed in the SQL Results view on the Result1 tab.
    SQL Results View

    Figure 15.13. SQL Results View

15.3.4. Deploy VDB from Model Explorer

You can also deploy your VDB first by selecting it in the Model Explorer and dragging/dropping it onto a connected JBoss Data Virtualization instance in the Server view, or right-click select Modeling > Deploy action.
Once deployed, you can select the VDB in the Server view and right-click select the Execute VDB action there. This will create a Teiid Connection Profile specific for that VDB, open the Database Development perspective and create a connection to your VDB. Continue with Step's 2 and 3 above.

Note

If you do not have a JBoss Data Virtualization instance defined or your default JBoss Data Virtualization instance is disconnected, the following dialog will be displayed if the Modeling > Deploy action is launched.
No Teiid Instance Defined

Figure 15.14. No Teiid Instance Defined

15.3.5. Executing a Deployed VDB

To execute a VDB, that's been deployed manually, follow the steps below:
  1. Open the Database Development perspective.
  2. Select the Database Connections folder and choose the New action to display the New Connection Profile dialog.
    New Connection Profile Dialog

    Figure 15.15. New Connection Profile Dialog

  3. Enter unique name for your profile, select an existing connection profile type and hit Next.
  4. In the Teiid Profile Wizard page, select the New Driver Definition button to locate and select the Teiid client jar on your file system. Configure your URL using your VDB Name, Host, Port, Username (default = admin) and Password (default = teiid).
    Teiid Connection Profile Dialog

    Figure 15.16. Teiid Connection Profile Dialog

  5. Select Next to view a summary of your new Teiid Connection Profile.
    Teiid Connection Profile Summary

    Figure 15.17. Teiid Connection Profile Summary

  6. Select Finish.
  7. Select your new Teiid connection profile and right-click select Open SQL Scrapbook, enter your designer SQL (i.e. SELECT * FROM TableXXXX), select all text and right-click select Execute Selected Text.
    SQL Scrapbook Editor

    Figure 15.18. SQL Scrapbook Editor