PowerCenter “Read” Java Transformation for JDBC

The PowerCenter “Read” Java Transformation for JDBC connection can create a connection to a database through
JDBC and extract data from this database. It works similarly to the PowerCenter SQL Transformation and so can be
used to either extract bulk data from a JDBC database (with one single Select request) or to perform a lookup on a
JDBC database. Updates and Deletes are not supported with this transformation.
The PowerCenter “Read” Java Transformation can be used when you need to read data from a database which
only supports JDBC. This transformation has input ports for the JDBC connection itself (JDBC Driver Name,
Connection Parameter, User, Password) as well as input ports for the SQL Statement that you want to pass to the
database. If needed there are also input ports to pass parameters used i.e. in a where clause. Any valid SQL
Statement that is supported by the JDBC driver can be passed to the transformation. The PowerCenter “Read” Java
Transformation for JDBC works a bit similarly to the PowerCenter SQL Transformation.
This java transformation supports up to 30 columns as output ports, which are filled with the results of the SQL
Statement (select * from). It is an active transformation, which can returns several output rows for each incoming
In addition there is a pass-through port that can be used if needed, to pass-through data, as the java
transformation is an active transformation.
The PowerCenter Read Java Transformation does not cache data like a PowerCenter Lookup transformation. Each
incoming row will send an SQL statement to the underlying database.
Let’s assume there is a JDBC table called “customer” (in a mySQL database), which has the following columns:
customer_id, first_name, last_name, city.
Customer_id is the primary key.

There is a flat file containing customer records, including customer_id and you want to create a lookup on the JDBC
table to get the first name, last name and city.
Create a mapping with the Flat File as source, an empty Expression Transformation and a “Read” java
transformation for JDBC:

The question mark will be replace by the value of the port “in_SQLParam1” at runtime in_Nbr_in_SQL_Param = 1 This port must be filled with 1 as there is only one SQL parameter in this case (in_SQLParam1) in_SQLParam1 = CUSTOMER_PK Contains the customer id coming from the source flat file outColumnx - The output ports outColumn1 to outColumn4 are linked to the target transformation. The result from the SQL statement is returning  Customer_id in outColumn1  First_name in outColumn2  Last_name in outColumn3  City in outColumn4  The other outColumnx ports are empty .inSQLStatement = ‘select * from customer where customer_id = ?’ The SQL statement is defined with a “where” clause.

1.required  User name to connect to the database o inConnectionPW .required  JDBC connection parameter.jar to the classpath of the integration service (Administration Console -> Integration Service -> Processes -> Edit -> Java SDK Classpath) For other version of PowerCenter.Installation : Import the Java Transformation into your PowerCenter repository by using the import objects functionality (either in the Designer or in Repository Manager). o inConnectionUser .mysql.required  In this port you can define the SQL statement (select) that you want to send to the database o inNbrInSQLParam – required . you will need to install the JDBC Driver from the corresponding database on the server where PowerCenter has been installed.required  Define the name of the JDBC driver.6.Driver’ for mySQL JDBC. Configuration : In order to make the JDBC Java Transformation work.1. See the third-party JDBC driver documentation for the exact name o inJDBCConnParam . add C:\Program Files\MySQL\JDBC\mysql-connector-java-5.13-bin.required  Password to connect to the database o inSQLStatement . For example with mysql JDBC : 'jdbc:mysql://localhost/test' where localhost is the hostname of the mysql instance and test the name of the schema. if you use PowerCenter 9.x on Windows and want to connect to MySQL.jdbc. In addition you will need to add the path and the JDBC jar file name to the classpath of the PowerCenter integration service : For instance. please refer to your PowerCenter documentation Informatica Product Requirements : PowerCenter 8.x PowerCenter 9. For Example ‘com.x Implementation in a mapping  Input ports : o inJDBCDriverName .13\mysql-connector-java-5.

inSQLParamx – optional  A maximum of 6 SQL input parameters can be defined. you can pass data through the transformation by using this port Other details .If you use the PowerCenter Read Java Transformation for JDBC as a lookup. no row will come out of the java transformation. only the first 6 ports will be filled (outColumn1 – outColumn6). These ports can be used i. you will need to modify the java code. o Feel free to customize the java source code if needed. to define a “where” clause containing value that comes from the source definition and changes for each request. you can define in your mapping a dummy source definition which generates only one row. If you have a table with more columns. A maximum of 30 columns can be returned.If you want to read all the data from a JDBC database (as you would do with a source definition).  In/Output Port o InOutPassthroughPort  The Java transformation is active. . define inNbrinSQLParam = 0.e. Define how many “inSQLParamx”-ports are filled (see hereunder for the description of the inSQLParamx ports). for example if you need more input ports inSQLParam or more output ports outColumn. If the SQL statement returns 6 columns. Each incoming row will send an SQL statement (select) to the database . it will not cache the data in memory. so that the java transformation only receives one input row and then send the SQL request to the database and returns all selected rows. If no inSQLParam port is filled. If you need it.  If no row is returned by the SQL Statement.  Output Ports o outColumnx  Contains the result of the select statements.