2

我正在尝试使用 Java API 与 informatica 连接。我很想在使用库的位置 C:\Program Files\Informatica\PowerCenter8.6.1\MappingSDK\samples\src\com\informatica\powercenter\sdk\mapfwk\samples 运行示例com.informatica.powercenter.sdk.mapfwk.core.*

当我尝试运行 CreateConnectionSample.java(simple connection to repository) 时出现异常。

代码:

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);

我得到了例外

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

以前有人做过吗?谁能帮我设置Java API。

4

1 回答 1

2

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);}
}
于 2014-04-25T15:40:29.077 回答