top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Java API for Informatica

0 votes
1,463 views

I am trying to use Java API to connect with informatica. I am tyring to run the samples at location C:\Program Files\Informatica\PowerCenter8.6.1\MappingSDK\samples\src\com\informatica\powercenter\sdk\mapfwk\samples which uses com.informatica.powercenter.sdk.mapfwk.core.* libraries.

When I try to run CreateConnectionSample.java(simple connection to repository) I am getting exception.

code:

CachedRepositoryConnectionManager rpMgr = new CachedRepositoryConnectionManager(
            new PmrepRepositoryConnectionManager());
    Repository rep = new Repository();
    RepoProperties repoProp = new RepoProperties();

    repoProp.setProperty(RepoPropsConstant.PC_CLIENT_INSTALL_PATH,
            "C:\\Program Files\\Informatica\\PowerCenter8.6.1\\client\\bin");
    repoProp.setProperty(RepoPropsConstant.TARGET_REPO_NAME, "EDW_DEV_REPO");
    repoProp.setProperty(RepoPropsConstant.REPO_SERVER_DOMAIN_NAME, "DOM_GWM_DEV01");
    repoProp.setProperty(RepoPropsConstant.SECURITY_DOMAIN, "MSSB_INFA_DVLPR_DEV");
    repoProp.setProperty(RepoPropsConstant.ADMIN_USERNAME, "Username");
    repoProp.setProperty(RepoPropsConstant.ADMIN_PASSWORD, "Password");
    repoProp.setProperty(RepoPropsConstant.TARGET_FOLDER_NAME,"CORE");
    rep.setProperties(repoProp);
    rep.setRepositoryConnectionManager(rpMgr);
    ConnectionObject connObj = new ConnectionObject("Con", ConnectionAttributes.CONN_TYPE_RELATION);
    rep.createConnection(connObj);

I am getting exception

com.informatica.powercenter.sdk.mapfwk.exceptions.ConnectionFailedException: Failed to list connections in PowerCenter Repository

Have anyone done this earlier? Can anyone help me to setup the Java API.

posted Jul 18, 2014 by Sunil

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Well, this is really old, and hopefully you ended up getting connected using the SDK. Here's some recent code I put together to get a connection and query some stuff about workflows.

public static void main(String[] args) throws Exception {
if(System.getenv("INFA_DOMAINS_FILE") == null)                  // make sure .infa file exists
    throw new Exception("INFA_DOMAINS_FILE path not set in environment variables.");

Repository rep = new Repository();
RepoConnectionInfo rci = new RepoConnectionInfo();
rci.setRepoServerHost("your host DNS name");                    // set host URI     
rci.setRepoServerPort("your host port number");                                 // host port
rci.setRepoServerDomainName("your-domain-name");                    // repository domain name
rci.setTargetRepoName("your-repository");                           // repository
rci.setSecurityDomain("e-directory");                           // security type
rci.setAdminUsername("your-credentials");                               // uid
rci.setAdminPassword(getPassword());                            // pwd (stored in environment variable -- encoded so it's not cleartext)
rci.setPmrepCacheFolder("c:\\users\\your-credentials\\Informatica\\");  // some cache folder that must be set  
rci.setPcClientInstallPath("C:\\Informatica\\9.0.1\\clients\\PowerCenterClient\\client\\bin\\");
rep.setRepoConnectionInfo(rci);                                                 // provide connection info to rep object
RepositoryConnectionManager repmgr = new PmrepRepositoryConnectionManager();    // set up repository connection manager
rep.setRepositoryConnectionManager(repmgr);                                     // tell repository to use connection manager

System.out.println("Folders:");
System.out.println("===========================================================================");
List<Folder> folders = rep.getFolders();
for(Folder f: folders) {  System.out.println(f);}

}

answer Jul 23, 2014 by Shweta Singh
Similar Questions
+3 votes

Can I write sql queries in Java transformation? Is there any possibilities?

I need to do query like this

String ID = select id from tablename where name='XXXX'.
+3 votes

How do I access a mapping parameter ($$myvariable) from a Java Transformation in Informatica Powercenter?

What I want to do is to make a Java transformation reusable by making a part of it configurable, and a variable seemed suitable for that, however I haven't been able to access (read) a variable from the Java code.

0 votes

Sql case statement is selecting the records but not returning the conditions in informatica

ex. Select *,case if emp_de = 'M' and leave is not null then 'Yes',when if emp_de = 'M' and leave is null then 'No' As 'Remark' end from EMP table where emp_Sal <2000.
the query is working fine in the informatica but the condition Yes or No not updating in the Remark port.

...