Problem with my PHP code
Posted: Thu Apr 10, 2003 11:54 pm
Hi friends
I created a webpage thru which i executed Db2 commands using
System function available in PHP.I created an instance which i set it to the
environment variable .Now when i try to create a sample Database i get the
error "SYSTEM" does not have the authority to perform the requested
command".I am able to do all these functions thru normal DB2CLP but unable
to achieve these tasks thru webpage.Can anyone help me to solve this
problem at the earliest?I have attached the code below which could be helpful for u to find
a solution.Thanx in advance.bye
Thanks and regards
Sriram
<?php //Start of PHP
session_start(); //Staring a SESSION
$_SESSION['instance']=$_POST[instance];
$_SESSION['Login']=$_POST[Login];
$_SESSION['pwd']=$_POST[pwd];
$instance=$_SESSION['instance'];
$Login=$_SESSION['Login'];
$pwd=$_SESSION['pwd'];
$instance contains the instance name obtained from the previous page in a
form
//ly $login and $pwd contains the domain username and password
system('db2stop'); //Stopping the current instance if any
$ins="db2icrt ".$instance; Eg Instance name is:::"newinst"
system($ins); //Executing $ins
echo "<BR>Instance ($instance) created succseefully";
prints::Instance (newinst) created succseefully
putenv("db2instance=$instance"); Setting the current instance to env
variable
system('db2cmd /c /w /i db2 get instance');
Prints ::The current database manager instance is: NEWINST
$att="db2cmd /c /w /i db2 attach to ".$instance." USER ".$Login." USING
".$pwd; //Attach the instance
system($att);
system('db2start');
Prints::
SQL5043N Support for one or more communications protocols failed to start
successfully. However, core database manager functionality started
successfully.
system('db2sampl');
Prints::
SQL1092N "SYSTEM" does not have the authority to perform the requested
command
//I need to create sample db only .My prj works around this databse
session_write_close();
?> //End of PHP
I created a webpage thru which i executed Db2 commands using
System function available in PHP.I created an instance which i set it to the
environment variable .Now when i try to create a sample Database i get the
error "SYSTEM" does not have the authority to perform the requested
command".I am able to do all these functions thru normal DB2CLP but unable
to achieve these tasks thru webpage.Can anyone help me to solve this
problem at the earliest?I have attached the code below which could be helpful for u to find
a solution.Thanx in advance.bye
Thanks and regards
Sriram
<?php //Start of PHP
session_start(); //Staring a SESSION
$_SESSION['instance']=$_POST[instance];
$_SESSION['Login']=$_POST[Login];
$_SESSION['pwd']=$_POST[pwd];
$instance=$_SESSION['instance'];
$Login=$_SESSION['Login'];
$pwd=$_SESSION['pwd'];
$instance contains the instance name obtained from the previous page in a
form
//ly $login and $pwd contains the domain username and password
system('db2stop'); //Stopping the current instance if any
$ins="db2icrt ".$instance; Eg Instance name is:::"newinst"
system($ins); //Executing $ins
echo "<BR>Instance ($instance) created succseefully";
prints::Instance (newinst) created succseefully
putenv("db2instance=$instance"); Setting the current instance to env
variable
system('db2cmd /c /w /i db2 get instance');
Prints ::The current database manager instance is: NEWINST
$att="db2cmd /c /w /i db2 attach to ".$instance." USER ".$Login." USING
".$pwd; //Attach the instance
system($att);
system('db2start');
Prints::
SQL5043N Support for one or more communications protocols failed to start
successfully. However, core database manager functionality started
successfully.
system('db2sampl');
Prints::
SQL1092N "SYSTEM" does not have the authority to perform the requested
command
//I need to create sample db only .My prj works around this databse
session_write_close();
?> //End of PHP