Sunday, 22 June 2014

Parametrizing Username and Password of Relational Connection ..

Why --It's always advisable to parametrize  as much as values you can, as it will be helpful for maintainability and also to accommodate the future changes. However, parametrization of Relational Connection is not straight forward.
If you have relational connection created already with pre-defined Schema and Password at connection itself, your job is quite easy. However, hard coding of password at connection level is not advisable and you will find Infra Architecture always reluctant for it.

How -- When you have relational connection [Source or Target] always parametrize 3 values
1. Connection Name
2. User / Schema Name
3. Password

Lets create a simple mapping - m_ClobToBlob - which will have both source and target as relational table. We will parametrize the source connection and keep target connection hardcoded at workflow level.

We have connection created as ORCL which is pointing to HR schema having password as magogate.

















Let's create a corresponding parameter file ClobToBlob.param for this session with entries as below

[MyWork.s_m_ClobToBlob]
$DBConnection_Source=ORCL
$Param_Passwd=magogate

Specify the parameter file path at session properties as below

Now, once you specify parameter file path , validate the workflow / mapping and run the workflow.

Your workflow will get completed successfully. Just verify if the parameter $DBConnection_Source got initialized with corresponding values or not.

Now, change the ORCL connection at workflow and change Password from hardcoded value to Parameter value as below


Also, edit the corresponding parameter file entries as below and again run the workflow
[MyWork.s_m_ClobToBlob]
$DBConnection_Source=ORCL
$Param_Passwd=1exNvZTHYXEznb8c/ckAUA==

Even though you have specified the password value at your parameter file, surprisingly your workflow will fail giving below error

Severity    Timestamp    Node    Thread    Message Code    Message
ERROR    5/6/2014 9:09:06 AM    node01_gogate    DIRECTOR    TM_6279    The session instance [s_m_ClobToBlob] encountered the following run-time validation error: [Required Password is missing for Connection ORCL.

Verified byte code for the Java transformation. The transformation is valid.
Verified byte code for the Java transformation. The transformation is valid.
].


Now, instead of specifying direct password value in parameter file, you convert your password using below command at Unix and give encrypted value at parameter file against $Param_Passwd .




 Let's run the workflow after doing these changes and you will find that it will get succeed.


Verify the corresponding session log, and you will find that the password reflected in session log is encrypted and same as what we have specified in parameter file. So informatica internally converts encrypted password to the original one.

Also, if you parametrize the password you always have to specify encrypted password in parameter file.

No comments:

Post a Comment