Informatica

Java Transformation in Informatica

Java transformation in Informatica PowerCenter uses Java programming language to transform the data. It is not necessary to write the entire java code or use an external java development environment as the java code can be entered as snippets in the power center designer client.
The code in Java transformation can invoke Informatica's custom expressions, user-defined functions, unconnected transformations and mapping variables. Java methods, variables, third-party API's, built-in Java packages and static code can be invoked as well.
Java transformation can be re-usable and it can be defined as both active or passive Informatica object.

Configuring Java Transformation
Import Packages: Import 3rd party java packages, built-in or custom Java packages
Helper Code: Declare user-defined variables and methods for the Java transformation class.
On Input Row: The Java code is executed one time for each input row. Only on this tab the input row can be accessed.
On End Of Data: Defines the behavior after processing all the input data.
On Receiving Transaction: Code which is executed when a transaction is received by the transformation.
Java Expressions: Used for defining and calling Java expressions.

Implementing Java Transformation
  • Import source table DEPT from database.
  • Create target table with the same structure as source table.
  • Drag both source and target to the mapping designer. 
  • Go to the transformations-> Create-> Select java transformation->OK 
  • Edit Java transformation-> Go to ports tab
  • Add ports like below figure.
     
  • Go to java code tab and write below code. 
                        int x=0;
                        for(x=0;x<=5;x++)
                        {
                        DEPTNO=in_DEPTNO;
                        DNAME=in_DNAME;
                        LOC=in_LOC;
                        generateRow();
                         }  

  • Connect source qualifier ports to input ports of java transformation.
  • Connect output ports from java transformation to target table.  
  • Save the mapping 
  • Create workflow and session.
  • Run the mapping
  • The output preview will be like below. 




Powered by Blogger.