DB-DB Sample Query Readme
A copy of this readme is included with the
DB-DB sample in your Liquid Data installation at <WL_HOME>/liquiddata/samples/buildQuery/db-db/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
This query demonstrates how to use Liquid
Data to construct a query that integrates the data from two distributed
heterogeneous database sources.
For example, a wireless service provider
has customer information stored in one database server. All the promotion plans
are managed by another database server. This sample query illustrates how to use
Liquid Data to extract qualified promotion information for a customer.
Traditionally, an application developer needs to write a set of data access
methods and some logic join code to complete the information extraction and
assembly. In Liquid Data, we demonstrate to use one single XQuery statement to
declaratively accomplish the same task in much cleaner way.
How to Run the Query
- Start the Liquid Data Samples server.
- Start the Data View Builder.
- In the Data View Builder, open the following project
file: <WL_HOME>/liquiddata/samples/buildQuery/db-db/e2e-promotion.qpr
- Click the Test tab. (This shows the generated query
statement.)
- 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
- Configure the Wireless relational database data
source as follows:
- JDBC connection pool: MyWirelessPool
(username=wireless, password=wireless)
- JDBC data source: MyWirelessDS
- Liquid Data "Relational Database" data
source: MyWireless-LD-DS (Schema=WIRELESS)
- Configure the CRM relational database data source
as follows:
- JDBC connection pool: MyCRMPool (username=crm,
password=crm)
- JDBC data source: MyCRMDS
- Liquid Data "Relational Database"
data source: MyCRM-LD-DS (Schema=CRM)
Build the Query in the Data View Builder
- Create a new project.
- Open the Data Sources you just defined: MyWireless-LD-DS,
and MyCRM-LD-DS
- Add promotionData.xsd from the repository as the target
schema
- Map the FIRST_NAME, LAST_NAME, CUSTOMER_ID, STATE from
SOURCE MyWireless-LD-DS->db->CUSTOMER element to the TARGET
PromotionInfo->Customer_promotion->CUSTOMER.
- Map the PROMOTION_NAME from SOURCE MyCRM-LD-DS->db->PROMOTION
to the TARGET PromotionInfo->Customer_promotion->PROMOTION_PLAN->PROMOTION_NAME.
- Map the PLAN_NAME, START_DATE, TO_DATE, PRICE from
SOURCE MyCRM-LD-DS->db->PROMOTION_PLAN to the rest corresponding
elements in the TARGET schema PromotionInfo->Customer_promotion->PROMOTION_PLAN.
- Define the equal join condition on element CUSTOMER_ID
between Source MyCRM-LD-DS->db->Promotion and SOURCE MyWireless-LD-DS->db->CUSTOMER.
- Define the equal join condition on element STATE between
Source MyCRM-LD-DS->db->PROMOTION and Source MyCRM-LD-DS->db->PROMOTION_PLAN.
- Run the query. (Click the Test tab and click Run Query
button.)
Reference
- You can view the Wireless data base schema file at <WL_HOME>/liquiddata/samples/config/ld_samples/scripts/ddl/WIRELESSP.sql
- You can view the CRM database schema at <WL_HOME>/liquiddata/samples/config/ld_samples/scripts/ddl/CRMP.sql
- You can view the target schema at <WL_HOME>/liquiddata/samples/config/ld_samples/ldrepository/schemas/promotionData.xsd
- You can view the query statement at <WL_HOME>/liquiddata/samples/config/ld_samples/ldrepository/stored_queries/promotion.xq