# DB-CPT Sample Query Readme

A copy of this read me is included with the DB-CPT sample in your Liquid Data installation at <WL_HOME>/liquiddata/samples/buildQuery/db-cpt/readme.htm. (The default install home for Liquid Data is bea/weblogic700.)

This readme includes the following topics:

- What this Query Demonstrates
- How to Run the Query
- If You Want to Re-create the Query . . .

## What this Query Demonstrates

The sample for crm query demonstrates how to use Liquid Data to create an integrated view that shows the connection of two different Enterprise Information Systems (EIS), database, and Complex Parameter Type (CPT). Creating an integrated view provides the ability to seamlessly access separate EISs using a single query.

For example, A CRM service provider uses a relational database system to manage its promotion plan. A CRM CPT has the promotion plan name for a given state and wish to extract the details of one or more matching plan name from the database. We use the Liquid Data engine to seamlessly access CRM information across different types of Enterprise Information Systems (EIS).

## How to Run the Query

1. Start the Liquid Data Samples server.

2. Start the Data View Builder.

3. In the Data View Builder, open the following project file: <WL_HOME>/liquiddata/samples/buildQuery/db-cpt/ cptSample.qpr

4. Click the Test tab. (This shows the generated query statement.)

5. Specify the location of the CPT sample XML stream for CPTSAMPLE parameter for example <WL_HOME>/ liquiddata/samples/config/ld_samples/ldrepository/xml_files/crm-p-cptSample.xml

6. Click the "Run Query" button and view the XML result.

## If You Want to Re-create the Query . . .

### Configure the Data Sources in the Administration Console

1. Configure the BroadBand relational database data source as follows:

· JDBC connection pool: MyCrm (username= crm, password= crm)

· JDBC data source: MyCrmDS

· Liquid Data "Relational Database" data source: MyCrm-LD-DS (Schema=CRM)

2. Configure the CPTSAMPLE CPT as follows:

· Alias: CPTSAMPLE

· Schema: crm-p-cptSample.xsd

· Namespace URI: urn:schemas-bea-com:ld-cptSample

· Schema Root Element Name: db

### Build the Query in the Data View Builder

1. Create a new project.

2. Open the Data Sources you just defined: a relational database called MyCrm-LD-DS and a CPT called CPTSAMPLE

3. Add cpt_sample.xsd from the repository as the target schema

4. Follow the steps in the Getting Started guide under "Step 6. Construct the Query" to build the CRM Query.

5. When creating the mapping remember to join on the promotion_name in the CPTSAMPLE with Crm LD relational source.

6. Specify CPT xml stream.

7. Run the query. (Click the Test tab and click Run Query button.)

### Reference

- You can view the CRM database schema at <WL_HOME>/liquiddata/samples/config/ld_samples/ldrepository/schemas/CRMP.sql
- You can view the CPTSAMPLE XML schema at <WL_HOME>/liquiddata/samples/config/ld_samples/ldrepository/schemas/ crm-p-cptSample.xsd
- You can view the target schema at <WL_HOME>/liquiddata/samples/config/ld_samples/ldrepository/schemas/ cpt_sample.xsd
- You can view the query statement at <WL_HOME>/liquiddata/samples/config/ld_samples/ldrepository/stored_queries/ crm-cptSample.xq