Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Location
    India
    Posts
    14

    Smile Unanswered: DB2 CLP commands cannot be executed thru a webpage

    Hi all
    I succeded executing DB2 system commands thru webpage using PHP by creating a batch file or directly.but the problem is that db2cmd.exe is not executed by the system,backtick or exec operators.I want everything to be done thru webpage and not using command prompt in winnt.
    code is
    <?php
    $instance="TEST";
    $string="db2icrt".$instance;
    system($string); created an instance;
    putenv('DB2INSTANCE=$instance'); set it to env variable
    Now comes the error::
    system('db2cmd.exe'); //Intialising command line processor
    Error reported //Command line env not initialised
    system(db2.exe update dbm cfg using SYS_ADM groupname);
    error reported //Command line env not initialised
    ?>
    So i cannot execute clp commands but can exec only system commands like db2icrt,db2idrop....is there any solution to this problem.
    Im using PHP4.0 apache server and WINNT.
    Thanks in advance
    Bye

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: DB2 CLP commands cannot be executed thru a webpage

    Have a look at the db2 command reference .... I think /c /w /i options will be suitable for you

    db2cmd /c /w /i db2 list applications

    HTH

    Cheers

    Sathyaram

    Originally posted by vram
    Hi all
    I succeded executing DB2 system commands thru webpage using PHP by creating a batch file or directly.but the problem is that db2cmd.exe is not executed by the system,backtick or exec operators.I want everything to be done thru webpage and not using command prompt in winnt.
    code is
    <?php
    $instance="TEST";
    $string="db2icrt".$instance;
    system($string); created an instance;
    putenv('DB2INSTANCE=$instance'); set it to env variable
    Now comes the error::
    system('db2cmd.exe'); //Intialising command line processor
    Error reported //Command line env not initialised
    system(db2.exe update dbm cfg using SYS_ADM groupname);
    error reported //Command line env not initialised
    ?>
    So i cannot execute clp commands but can exec only system commands like db2icrt,db2idrop....is there any solution to this problem.
    Im using PHP4.0 apache server and WINNT.
    Thanks in advance
    Bye

  3. #3
    Join Date
    Apr 2003
    Location
    India
    Posts
    14

    Smile Re: DB2 CLP commands cannot be executed thru a webpage

    Hi
    Thanks a lot.Its working.but why this is not working
    system('db2cmd /c /w /i db2instance=test');
    I created an instance test and try to set it to env variable.but the abv one is not working.when i try this one
    system('db2cmd /c /w /i db2 get instance');
    it shows the current instance.what is the problem.Thx in advance
    Bye









    Originally posted by sathyaram_s
    Have a look at the db2 command reference .... I think /c /w /i options will be suitable for you

    db2cmd /c /w /i db2 list applications

    HTH

    Cheers

    Sathyaram

  4. #4
    Join Date
    Apr 2003
    Location
    India
    Posts
    14

    Smile Re: DB2 CLP commands cannot be executed thru a webpage

    Hi
    Sorry !! A small change to the previous mail.The command i tried is:
    system('db2cmd /c /w /i set db2instance=test'); and not
    system('db2cmd /c /w /i db2instance=test');
    Thanks and regards
    Bye







    Originally posted by vram
    Hi
    Thanks a lot.Its working.but why this is not working
    system('db2cmd /c /w /i db2instance=test');
    I created an instance test and try to set it to env variable.but the abv one is not working.when i try this one
    system('db2cmd /c /w /i db2 get instance');
    it shows the current instance.what is the problem.Thx in advance
    Bye

  5. #5
    Join Date
    Apr 2003
    Location
    India
    Posts
    14

    Re: DB2 CLP commands cannot be executed thru a webpage

    Hi
    I got it.I used putenv("db2instance=instancename");thanks.Bye




    Originally posted by vram
    Hi
    Sorry !! A small change to the previous mail.The command i tried is:
    system('db2cmd /c /w /i set db2instance=test'); and not
    system('db2cmd /c /w /i db2instance=test');
    Thanks and regards
    Bye

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •