creating sample db thru web

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
vram
Forum Newbie
Posts: 9
Joined: Tue Apr 08, 2003 3:58 am

creating sample db thru web

Post by vram »

Hi all
I m facing problem in my project.I want to create an instance,then setting it to environment variable,then i should create a sample database.I succeded in the first two task but sample db creation failed .I know the reason.since im executing from a webpage,db2 has no way to know which user tries to create sample db.hence the authorization error.Anybody pls tell me how to grant previlige to the user bfore creating sample db.Everything has to be done thru webpage.for ur conveniance,i ve included the code below

Thanks in adv.Bye.
Thanks and regards
Vram


<?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

$ins="db2icrt ".$instance." -s ee -p D:\ -u ".$Login.",".$pwd;
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


echo "<BR>";
system('db2cmd /c /w /i db2 get instance');

Prints ::The current database manager instance is: NEWINST

echo "<BR>";


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

session_write_close();


?> //End of PHP
Post Reply