Search code examples
javainformaticainformatica-powercenter

Running pmcmd from java


I am trying to run pmcmd and pass arguments from java. This is my code :

String cmd="C:\\Informatica\\9.6.1\\clients\\PowerCenterClient\\CommandLineUtilities\\PC\\server\\bin\\pmcmd.exe";
    final Process cmdProcess;

    cmdProcess = Runtime.getRuntime().exec(new String[]{cmd,"connect -sv IS_NAME -d DOMAIN_NAME -u USER -p PWD"});
    cmdProcess.getOutputStream().close();

The problem is I am not able to get the desired output. I get the following error:

ERROR: Unknown command [connect]

When I try the same command on the command line, it works.

pmcmd>connect -sv IS_NAME -d DOMAIN_NAME -u USER -p PWD

The output:

Connected to Integration Service:[IS_NAME].

Can anyone tell what mistake I am doing?


Solution

  • I had to issue a command within the pmcmd process. So I modified my code and it works :

                    String cmd="C:\\Informatica\\9.6.1\\clients\\PowerCenterClient\\CommandLineUtilities\\PC\\server\\bin\\pmcmd.exe";
                    final Process cmdProcess;
    
                    cmdProcess = Runtime.getRuntime().exec(new String[]{cmd,""});
                    OutputStream out = cmdProcess.getOutputStream();
                    out.write("connect  -sv IS_NAME -d DOMAIN_NAME -u USER -p PWD".getBytes());
                    out.close;