Tuesday, August 2, 2016

How to create relationship between options and task in ODI procedure?

Scenario:
There are three steps in procedure based on the option value I need to skip or execute task in ODI procedure.

For Example:
Step 1: Create Table
Step 2: Truncate Table
Step 3: Insert record into table

Options:
Create
Truncate

If I select create option value as true then it needs to create table.
If I select Truncate option value as true then it needs to truncate table.

Approach:
Step 1:
Create a procedure
With three tasks as follows

Step 2:
Create two options (go to option tab and click on '+' symbol)
Step 3:
Select Create Option and go to property inspector and then expand options -- Disable Always execute check box and enable Create check box as follows
Step 4:
Repeat step 3 for truncate and change accordingly

Step 5:
Create a package.
Drag and drop procedure into package --  go to options tab -- select create option and set value to "true"

Step 6:
Execute it

Output:

In above execution, it skipped truncate step

Step 7:
Now we will check by changing the options as create - "false" and Truncate as "true"

Step 8: 
Execute Package

Output:

In above execution, it skipped create step

[Note: As mentioned in above steps our knowledge modules will work]

How to pass parameters to ODI procedure?

Scenario:
We need to pass directory location so that it will pick file names and delimited file names with ';' as mentioned in below example

For Example:
Dir: <FOLDER_LOCATION>
      Sample_File.txt(File)
      Sample_File.csv(File)
      Sample_File.xls(File)

Output should be 'Sample_File.txt;Sample_File.csv;Sample_file.xls'

Steps:

Step1:
Create a procedure and select target technology as Oracle

Step 2:
Go to Option and create new option whose name is "Dir" , Data type as "Text" and Direct Value "<DIRECTORY_LOCATION>" (eg : C:/Sample_files)

Step 3:
Copy below code and paste in target side and select technology as  Oracle and Logical Schema accordingly

<?
import java.io.File;
public class FileLists{
   public static String FileNames() {
     
      File f = null;
      String[] FileList;
   String fileNames="";
           
      try{    
       
         f = new File("<%=odiRef.getOption( "Dir" )%>");
         FileList = f.list();
         for(String FileName:FileList)
         {
           if(FileName.contains("."))
     {
   if (!fileNames.isEmpty())
    fileNames  = fileNames+','+ FileName ;
   else
    fileNames = FileName;
     }
         }
 
      }catch(Exception e){
         e.printStackTrace();
      }
    return fileNames;
   }
}
?>
select '<?=FileLists.FileNames()?>' from dual


Step 4:
Drag and drop the procedure into package and go to options and provide value to Dir option as below



Monday, August 1, 2016

Static Control in ODI 12c

Scenario:
While loading 10000 records if there is an error in one/more records then I need to make a note that record into E$ (error table) and all records into target table.

Example:
Source

As per requirement, whose MID values are null consider to be invalid records. Though those are not valid records we are accepting it and providing to option to end-user to correct by themselves by providing error message
(i.e., SRC <= TRG+E$)

Static Control:
Data quality validation is done after loading the data into target tables.

CKM will validate data on target table and if any error is detected it will be inserted to E$ table and SNP_CHECK_TAB.
Remember that the incorrect entry will not be deleted as in Flow control. 

Approach:
Step 1:
Create Model -- Reverse Engineer source datastore and target datastore 
Step 2:
Expand Target data store -- Right click on constraint --Select  "New Condition"
Message is nothing error message
Actually this is condition is not there at data server level. Type indicates it is ODI condition.

Step 3:
Go to Control tab and enable check box for both flow control and static control

Step 4:
Create mapping -- Drag and drop Source and target data store then connect source output connector to target input connector -- go to physical tab and then select target datastore -- go to Property Inspector -- Integration Knowledge Module --  Enable Static control as true 


Step 5:
Execute it

Output:


Flow Control in ODI12c

Scenario:
While loading 10000 records if there is an error in one record then I need to load that record into E$ (error table) and rest of records into target table.

Example:
Source

As per requirement, whose MID values are null consider to be invalid records
(i.e., SRC = TRG+E$)

Flow Control:
Data quality validation is done before loading the data into target tables.
Check Control Knowledge Module (CKM) will create E$ table and SNP_CHECK_TAB table for data quality check.

It will validate data in I$ table before inserting data into target table.
If it has any errors then it will delete from I$ table and insert into E$ table and common error message and interface name into SNP_CHECK_TAB

Approach:
Step 1:
Create Model -- Reverse Engineer source datastore and target datastore 
Step 2:
Expand Target data store -- Right click on constraint --Select  "New Condition"
Message is nothing error message
Actually this is condition is not there at data server level. Type indicates it is ODI condition.

Step 3:
Go to Control tab and enable check box for both flow control and static control

Step 4:
Create mapping -- Drag and drop Source and target data store then connect source output connector to target input connector -- go to physical tab and then select target datastore -- go to Property Inspector -- Integration Knowledge Module --  Enable Flow control as true 

[*Note: There should be key if we enable flow control. In my example EMPID is key column]

Step 5:
Execute it

Output:




Tuesday, July 26, 2016

Unable to Open SQL Developer

Unable to find Java Virtual Machine. To point to a location of a Java Virtual Machine

Solution
The Oracle SQL developer is NOT supported on 64 bits JDK.
To solve it, install a 32 bits/x86 JDK and update your SQL developer config file,so that it points to the 32 bits JDK.

Edit the “sqldeveloper.conf“, which can be found under “{ORACLE_HOME}\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf“, make sure “SetJavaHome” is pointing to your 32 bits JDK.
For example, “SetJavaHome C:\Program Files (x86) \Java\jdk1.6.0_13“ or
“SetJavaHome C:\Program Files (x86)\Java\jdk1.7.0"

If you update with JDK1.7.* version then again you may face following issue
msvcr100.dll is missing from your computer

Solution:
Go to jdk1.7.0 installed path jdk1.7.0\jre\bin copy msvcr100.dll and paste it into ORACLE_HOME\sqldeveloper\sqldeveloper\bin
Now it will start SQL Developer



Thursday, July 21, 2016

Invoking Webservice Using ODI

Scenario:
We need to invoke web service and store response file in a specific location

Pre-Requisites:

WSDL URL : http://www.webservicex.com/globalweather.asmx?WSDL

XML Request : <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.webserviceX.NET">
<env:Header/>
<env:Body>
<ns1:GetCitiesByCountry>
<ns1:CountryName>India</ns1:CountryName>
</ns1:GetCitiesByCountry>
</env:Body>
</env:Envelope>

Procedure:
Step 1:
Create Package "PKG_WEBSERVICE"

Step 2:
Drag and drop the ODIInvokeWebservice tool from Tool box into package

Step 3:
Provide properties as mention below

Output:
It will create appropriate response file in a specified location.
Completed Successfully!!!!

Friday, July 8, 2016

Create Oracle Data store on fly using File Data store without writing DDL script

Scenario:
We need to create a table with same structure as file Structure without writing DDL scripts in ODI 12c

Steps:

Step 1:
Go to Designer -- Go to Model Accordion -- Create new File Model -- right click and create new Datastore -- Go to Definition tab and select File -- Go to File and select File format type as "Delimited" , Heading as "1" , Field Separator -- Other as "," -- Go to Attributes and click Reverse Engineering button at left side top

Step 2:
Go to Designer -- Go to Model Accordion -- Create new Oracle Model by providing appropriate technology and Logical Schema and save it. Now COPY File Datastore from file model and paste that into Oracle Model.


Now double click on Oracle Datastore (CompanyHierarchy) --  Go to definition tab and change resource name as COMPANY_HIERARCHY (i.e., we are giving table name as COMPANY_HIERARCHY)

Step 3:
Create a new mapping -- Drag and drop FileDatastore as source and Oracle Datastore as Target
Go to Physical Tab and select appropriate KM's (LKM File to SQL and IKM Oracle Simple Insert -- Select option for Create Target Table as "true")

Step 4:
Execute mapping
Completed Successfully!!!