How to use encoded password in ODI SDK

How to use encoded password in ODI SDK:

Today I am going to share very interesting thing 😀 . I was struggling a lot to get the work around on this issue. Searched a lot over internet and didn’t get any solution.

Finally I found something that helps to an extent. I would like to give special thanks my friend Tina for her helping hand. Take a look on below code snippet. You can clearly see I have hardcoded the master repository password. Is there any ODI Admin who is going to provide the master repository credentials?? I know everyone will deny due to security issues.

package odi_sdk;
import oracle.odi.core.OdiInstance;
import oracle.odi.core.config.MasterRepositoryDbInfo;
import oracle.odi.core.config.OdiInstanceConfig;
import oracle.odi.core.config.PoolingAttributes;
import oracle.odi.core.config.WorkRepositoryDbInfo;
import oracle.odi.core.security.Authentication;
import oracle.odi.runtime.agent.invocation.RemoteRuntimeAgentInvoker;
import oracle.odi.domain.runtime.variable.finder.IOdiVariableValueFinder;
import oracle.odi.runtime.agent.invocation.StartupParams;
import oracle.odi.domain.runtime.variable.OdiVariableValue;
import oracle.odi.domain.runtime.variable.OdiVariableValueHistory;
import java.util.HashMap;
import java.util.Map;

public class InvokeScen {
public static void main(String[] args) {
String getDate="";
for(int i=0; i < args.length; i++){
getDate= args[i];
}
String Url = "jdbc:oracle:thin:@localhost:1521:xe";
String Driver="oracle.jdbc.OracleDriver";
String Master_User="odimaster";
String Master_Pass="odi";
String WorkRep="DEV_WORK";
String Odi_User="SUPERVISOR";
String Odi_Pass="SUNOPSIS";
String TEST_VARIABLE2="PRO_SDK_TEST.TEST_VARIABLE2";
String TEST_VARIABLE1="PRO_SDK_TEST.TEST_VARIABLE1";

Mapmap = new HashMap();
map.put(TEST_VARIABLE2, getDate);
StartupParams sp=new StartupParams(map);

MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,Master_Pass.toCharArray(), new PoolingAttributes());
WorkRepositoryDbInfo workInfo = new WorkRepositoryDbInfo(WorkRep, new PoolingAttributes());
OdiInstance odiInstance=OdiInstance.createInstance(new OdiInstanceConfig(masterInfo,workInfo));
………………………..
………………………..
………………………..

So lets try to use encoded password. I am sure this encoded password can be shared by odi admins as they are not going to share the actual passwords. Have a look on below bold lines.

package odi_sdk;

import oracle.odi.core.OdiInstance;
import oracle.odi.core.config.MasterRepositoryDbInfo;
import oracle.odi.core.config.OdiInstanceConfig;
import oracle.odi.core.config.PoolingAttributes;
import oracle.odi.core.config.WorkRepositoryDbInfo;
import oracle.odi.core.security.Authentication;
import oracle.odi.runtime.agent.invocation.RemoteRuntimeAgentInvoker;
import oracle.odi.domain.runtime.variable.finder.IOdiVariableValueFinder;
import oracle.odi.runtime.agent.invocation.StartupParams;
import oracle.odi.domain.runtime.variable.OdiVariableValue;
import oracle.odi.domain.runtime.variable.OdiVariableValueHistory;
import java.util.HashMap;
import java.util.Map;

import com.sunopsis.dwg.DwgObject;

public class InvokeScen {
public static void main(String[] args) {
String getDate="";
for(int i=0; i < args.length; i++){
getDate= args[i];
}
String Url = "jdbc:oracle:thin:@LOCALHOST:1521:XE";
String Driver="oracle.jdbc.OracleDriver";
String Master_User="ODIMASTER";
String Master_Pass="bQya,MIF5V,op0hn84BRC0g";
String WorkRep="DEV_WORK";
String Odi_User="SUPERVISOR";
String Odi_Pass="SUNOPSIS";
String TEST_VARIABLE2="PRO_SDK_TEST.TEST_VARIABLE2";
String TEST_VARIABLE1="PRO_SDK_TEST.TEST_VARIABLE1";

Mapmap = new HashMap();
map.put(TEST_VARIABLE2, getDate);
StartupParams sp=new StartupParams(map);
DwgObject dg=new DwgObject() {

@Override
public String getObjectLocation() {
// TODO Auto-generated method stub
return null;
}
};
@SuppressWarnings("deprecation")
MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,dg.snpsDecypher(Master_Pass).toCharArray(), new PoolingAttributes());
WorkRepositoryDbInfo workInfo = new WorkRepositoryDbInfo(WorkRep, new PoolingAttributes());
OdiInstance odiInstance=OdiInstance.createInstance(new OdiInstanceConfig(masterInfo,workInfo));
………………..
………………..
………………..

You are now good to go. Actually ODI SDK is very flexible and dynamic in nature. You just need to have little idea on java basics and then dig out to explore new things. Obviously limited to the given API by Oracle.

Okay so far so good. But here we will encounter another problem. The above passoword can be easily decoded by using the decypher method. 😀

System.out.println(dg.snpsDecypher(Master_Pass).toCharArray());

Now you might be thinking what is the use this encoded password then. 😉  Any java developer can print it easily.

Waiting for your comments.
That’s all for today 🙂

0

About the author

Bhabani(http://dwteam.in) - Currently Bhabani is working as Sr Development Engineer at Harman International. He has good expertise on Oracle, Oracle Data Integrator, Pervasive Data Integrator, MSBI, Talend and Java. He is also contributing in ODI-OTN forum for last 5 years. He is from India. If you want to reach him then please visit contact us page. If you have any doubts or concerns on the above article, please put your question here. Dw Team will try to respond it as soon as possible. Also dont forget to provide your comments / suggestions / feedback for further improvement. Thanks for your time.

Similar Posts

18 comments

you know, the encoded password is written in plain text, if hacker get the file, but he/she does not know the algorithm ,maybe MD5, DES,etc. so he/she may spend some time to decode it, maybe fail finally.
even he/she choose to decompile java class, the class maybe have be obfuscated, so cannot decompile.

so it might means I should not tell the API to decode it, right? 🙂

Yeah right, if there wouldn’t have any such security then people might not have gone for oracle product. But I am still digging on ODI SDK and trying to explore as much as I can. Lets see what is the next stop.

I am not able to use encoded password for odiuser(SUPERVISOR);
Is there any way to do this encoded password for SUPERVISOR.
Regds,
Aniket

Hi Bhabani,
Can you please provide the full code to invoke scenario in eclipse? I have certain codes but that relates to 10g.I am fine with hardcoded password 😀 .Its urgent.

How can i configure sdk in my system. When I installed ODI i had checked the option SDK. Now what should I do to use sdk. I am new to ODI. I got your blog from otnforum. Thnkas.

Hey, can you post all codes here? I am not able to invoke all scenarios via SDK..Is it necessary to have eclipse to run SDK programs ?? Also I am getting error while creating the instance.Please help.

why?
System.out.println(DwgObject.snpsDecypher(DwgObject.snpsEncode(“oracle”)))
there is no output?

So it is printing null ? Can you try to print the inner part 1st that is
System.out.println(DwgObject.snpsEncode(“oracle”))
Is it printing the encoded value ?

Let me know. Thanks

here’s my test code,if i run it,my console was in running state,and there is no output,i dont’t no why?
import com.sunopsis.dwg.DwgObject;
public class test {

public static void main(String[] args) {
System.out.println(DwgObject.snpsDecypher(DwgObject.snpsEncode(“oracle”)));
}
}

Try this
import com.sunopsis.dwg.DwgObject;
public class test {

@SuppressWarnings(“deprecation”)
public static void main(String[] args) {
String pPass=”Oracle”;
System.out.println(DwgObject.snpsEncode(pPass));
}
}

It should work. If still not working then compile and run the same in command prompt.

yes it work,print:”ccfpWomP.AZP6fFoRrsMP8R5Hg”
but i want to decode “ccfpWomP.AZP6fFoRrsMP8R5Hg” to “Oracle”

Yes it is working aswell.

import com.sunopsis.dwg.DwgObject;
public class test {

@SuppressWarnings(“deprecation”)
public static void main(String[] args) {
String pPass=”Oracle”;
System.out.println(DwgObject.snpsDecypher(DwgObject.snpsEncode(pPass)));
}
}

Anmol Kaushik

Hi Bhabani,

We should also have odiEncode and odiDecypher for these functions too, right?

In that case the deprecated function directive to the compiler may not be needed.

Thanks.
AK.

Hi,Bhabani.Thank you for your patience reply .My problem has been solved!

I am happy that you resolved your problem.

Hello,

I’m trying to make this example because I have the master repository password encoded.

I copied the script, but I have a problem with the next code line:

MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,dg.snpsDecypher(Master_Pass).toCharArray(), new PoolingAttributes());

It seems that snpsDecypher needs another param (type OdiInstance), but I don’t have any OdiInstance until I could connect getting the MasterRepositoryDbInfo object.

Could you help me in any way?
Thank you very much

I’m using ODI 12C right now

Did you solve that issue? I have the same problem and I don’t find any solution.

Leave a replay to tina Cancel reply

required*

Are you a human? *