You are on page 1of 20

Document: Oracle Data Integrator 11g (11.1.1.

3) XML Integration with ODI Description:


This is another document from ODI Beginner's Series. The document shows simple step by step approach to integration ODI with XML. Some simple transformations are also used to demonstrate the ODI capabilities. Join our professional training program to learn from industry experts.

History:
Version Description Change Author Publish Date

0.1 0.1

Initial Draft Review 1st

Anil Patel Amit Sharma

25-March-2012 25-March-2012

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

Oracle Data Integrator- XML Integration


Chapter No.

Title
Introduction to XML Integration with ODI Creating an XML Data Server Organizing an XML Model
Create Target Table in RDBMS Oracle11g Setting up an ODI Project for Interface xml and RDBMS

1. 2. 3. 4. 5.

Page No. 3 6
11 13 15

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

1.Introduction to XML Integration with Oracle Data Integrator :Data integration software is designed to transfer data between many different sources, including databases and XML. It is used to perform ETL Operations. The XML stands for extensible Markup Language. XML is a meta-markup language developed to deal with a number of the shortcomings of HTML. As more functionality was added to HTML to account for the diverse needs of users of the Web. Although the original purpose of XML was as a way to mark up content, it became clear that XML also provided a way to describe structured data thus making it important as a data storage and interchange format. XML provides many advantages as a data format over others, including: 1. Built in support for internationalization due to the fact that it utilizes unicode. 2. Platform independence (for instance, no need to worry about neediness). 3. Human readable format makes it easier for developers to locate and fix errors than with previous data storage formats. 4. Extensibility in a manner that allows developers to add extra information to a format without breaking applications that where based on older versions of the format. 5. Large number of off-the-shelf tools for processing XML documents already exists.

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

Structuring XML: DTDs and XML Schemas

1. XML :- The XML is a way to describe structured data there should be a means to specify the
structure of an XML document. Document Type Definitions (DTDs) and XML Schemas are different mechanisms that are used to specify valid elements that can occur in a document, the order in which they can occur and constrain certain aspects of these elements. An XML document that conforms to a DTD or schema is considered to be valid. Below is listing of the different means of constraining the contents of an XML document. 1. XML for sample :-

XML File

1). GEOGRAPHY_DIM.xml file is xml file which contain Data . 2). We can see its physical Location.

Fig.2: XML FILE ( GEOGRAPHY_DIM.XML)

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

2. Document Type Definitions (DTD): DTDs were the original means of specifying the
structure of an XML document and a holdover from XML's roots as a subset of the Standardized and General Markup Language(SGML). DTDs have a different syntax from XML and are used to specify the order and occurence of elements in an XML document. Below is a DTD for the above XML fragment. DTD FOR SAMPLE XML FRAGMENT

2. DTD File :DTD FILE

1). GEOGRAPHY_DIM.dtd file is xml dtd file which contain Structure of Database. 2). We can see contents of file and physical Location

Fig.3: XML FILE ( GEOGRAPHY_DIM.DTD)

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

2.Creating an XML Data Server & Physical schema :The XML Data Server corresponds to a XML file that is accessible through network. XML files are accessed through the Oracle Data Integrator Driver for XML(which is selected by time of creating Data Server i.e JDBC Driver and JDBC URL). The JDBC driver loads the XML file hierarchical structure in a relational structure in a schema stored in memory to enable SQL queries through JDBC (Java Database Connectivity). This is also able to unload the relational structure back in the XML File. PRE-REQUISITES :JDBC Configuration XML files are accessed through the Oracle Data Integrator Driver for XML. The driver is installed with Oracle Data Integrator. Connection Information You must ask the system administrator for the following information: The location of the DTD file associated with your XML file The location of the XML file The name of the Root element of your XML file

2.1 Create Data Server for XML Technology :Creation of data server is first step of integration with ODI With any technology, so create data server for XML, follow steps Step (1) : Select Topology Navigator then select Physical Architecture panel and select technology as XML then right click and select create new data server
Create Data Server for XML 1). Topology Navigator -> 2) Physical Architecture 3)Then write click on xml and Click New Data Server

Fig.4: XML Technology

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

Step 2) server .

: After click on New data server editor window will open then enter : Name of data

Fig.5: Creating Data Server for XML Technology Step 3) : Select JDBC and select driver for xml then select JDBC URL and write correct path e.g <jdbc:snps:xml?f=d:/xml/GEOGRAPHY_DIM.xml&d=d:/xml/GEOGRAPHY_DIM.dtd&re= GEOGRAPHY_DIM&s=GEO&ro=false&case_sens=true> And save it.

Fig. 6: JDBC Driver & URL for XML

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

Step 4) : Edit correct path with respect to location of file and file type i.e DTD and XML. <jdbc:snps:xml?f=d:/xml/GEOGRAPHY_DIM.xml&d=d:/xml/GEOGRAPHY_DIM.dtd&re= GEOGRAPHY_DIM&s=GEO&ro=false&case_sens=true> Then save it and test connection

Fig.7: JDBC Driver & URL for XML

2.2 Create Physical schema for XML Technology :

Creating Physical Schema Create Data Server for XML 1). Topology Navigator -> Right click on newly created data server & select 2) Physical Architecture create new click on xml and 3)Then writephysical schema 2) Then editor will open Click New Data Server and wright the name of schema. 3)Save

Fig.08: Physical Schema for XML Data Server GEO


http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com 8

2.3 Create Logical schema for XML Technology

Creating Logical Schema 1)Select Logical Architecture Panel in topology navigator then select technology as XML 2) Right click on xml technology and select new logical schema 3)Enter the name of schema and map with contexts. 4) Save.

Fig.09: Logical Schema for XML Technology GEO

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

3. Organizing an XML Model :3.1.Create an XML Model :- Create an XML Model


Creating XML Model 1)Connect to Designer Navigator . 2)Select Model panel under designer Navigator 3)Click on model icon then select create new model folder 4)After creation of model folder right click on model folder and select new model 5)Model editor window will open then enter information and press reverse engineering. 6)Now data is reversed to ODI.
Fig.10 : Create XML Model ( xml GEO)

3.2. Datastores under xml model :Datastores under xml model 1)Now we can view each datastores with respect to columns ,keys, constraints etc. 2) This is complete representation of source database in ODI.

Fig.11: Datastores (Table) in XML Model (xml GEO)

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

10

3.3. Datastore (Table) :City ( under xml model)

Fig.12: XML Model xml GEO and Table CITY & contents of City(48 Rows)

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

11

4.

Create Table in RDBMS Oracle11g for Staging and Target :-

4.1) Create table in any RDBMS for staging and Target :

Create Table for Staging and Target :1) Create user schema 2) Then create table for staging and target with same number of columns and datatypes as desired . 3) This is empty table.

Fig.13: Table CITY is created under Schema ORACLEXML

4.2)Create table in any RDBMS for staging and Target : Create Data server ,Physical schema ,Logical schema for ORACLEXML user of oracle. Then create model for user schema and get datastore in ODI.
Create Model for Oracle :1)Create Dataserver for Oracle and then physical schema 2) Then Create logical schema and mapped with contexts 3)Create model folder then model under designer navigator and apply reverser engineering and get datastores.
Fig.14: Model is creating for ORACLEXML schema

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

12

4.3) Datastore City staging and Target

Datastore City for target & staging :1)We can see now its empty 2) We have to load Data from xml - Oracle

Fig.15: Target (Oracle Model Folder)-> Oracle XML Model-> Datastore CITY

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

13

5.

Setting up an ODI Project for Interface xml and RDBMS :-

5.1 ) Setting up ODI Project and create interface for load data from xml to Oracle :
Setting up project and create interface :1)Connect to Designer Navigator then right click on project icon then create a new project 2) Then Import knowledge module :(i)LKM sql to Oracle (ii)IKM Oracle Incremental update

Fig.16: Project is Created for xml to Oracle & KM imported(LKM &IKM)

5.2 ) Create Interface for transform xml to oracle : 1:1 mapping


Create Interface :1)Create new interface. 2)Enter name ,contexts,staging area etc.

Fig.17: Interface City(XML to Oracle)

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

14

5.3) Take source and target in Interface and perform mapping 1:1

Fig.18: Interface Mapping (Source to Target ) Column to Column

5.4) Watch the Interface flow and execute the interface and see the execution result.

Fig.19 : Interface flow (source xml

staging Target) & Interface Executed Successfully

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

15

5.5) Now data is transformed from xml table city to Oracle table city :

Fig.20 : Table City in oracle is loaded with data by xml city table

http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com

16

6.

Interface Transformation - Join Operation :-

6.1) Take a Oracle city table as a source and load it into any target among ODI supported DB
Here we are taking source as Oracle city and target Oracle city_population table

Perform join operation :1) Take source as Oracle city table 2)Target Oracle city_population table 3)Task : here we will apply join operation in column (city_name,population)-(city_population) in target table 4)As shown in diagram

Fig.21 : Source and Target table in oracle (where well perform join operation by ODI 6.2)Create Interface and drag & drop source and target in Interface respectively
Mapping Columns (S->T) :1) Now we have to map column (City_name & Population) with (city_population). 2)Code for join in target is (city.city_name||||city.population) Where city is name of table and city_name &population is column 3)Check the statements whether correct or not.

Fig.22 : Mapping source (city_name &population)column->target(city_population) Column


http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com 17

6.3) Watch Interface flow and execute the interface followed by simulate the interface :When we simulate the interface so we can see code and number of steps generated b y ODI which is using for transformation ,Simulation is very important because we can see all internal operation and codes like E$ table for errors,I$ table for loading etc.

Fig.23 : Interface flow (source Oracle(City)

Target Oracle(City_Population) ) & Simulation

6.4) Watch the Interface flow and execute the interface and see the execution result
Once read simulation carefully so we can aware that what code ODI is generated for transformation of interface , then execute and we can see number of steps and logs, time etc. Then see desired result in tables.

Fig.24 : Simulation of Interface & then Interface Executed Successfully


http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com 18

Interface Transformation - Split Operation :7.1) Now we have to perform split operation : Source table is <oracle> <city_population> and Target table is <oracle><city_split> where we have to split single column into two column.

7.

Fig.25 : Source and Target table in oracle where well perform Split operation by ODI 7.2) Create Interface and perform mapping between Source and Target : We have to split
column (city_population into city_name &population so on target side select column city_name &Population & right code respectively for split. City_Name<SUBSTR(CITY_POPULATION.CITY_POPULATION,1,INSTR(CITY_POPULATION.CITY_POPULATION,'-')-1)>
Population <SUBSTR(CITY_POPULATION.CITY_POPULATION,INSTR(CITY_POPULATION.CITY_POPULATION,'-')+1)>

Fig.26 : Source and Target table in oracle where well perform Split operation by ODI
http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com 19

7.3) Watch Interface flow and execute the interface followed by simulate the interface: When we simulate the interface so we can see code and number of steps generated b y ODI which is using for transformation ,Simulation is very important because we can see all internal operation and codes like E$ table for errors,I$ table for loading etc.

Fig.27: Interface flow (source Oracle(City_Population)

Target Oracle(City_Split) ) & Simulation

7.4) Watch the Interface flow and execute the interface and see the execution result:
Once read simulation carefully so we can aware that what code ODI is generated for transformation of interface , then execute and we can see number of steps and logs, time etc. Then see desired result

in tables

Fig.28 : Simulation of Interface & then Interface Executed Successfully


http://learnodi.wordpress.com http://learnodi.blogspot.com http://hyperionguru.com 20

You might also like