Thread: CREATE USER through SQL possible?

CREATE USER through SQL possible?

From
"Adams, Joe"
Date:
I am trying to make a administration web page for postgreSQL users. The main
purpose of this web page is to add , remove and modify pgsql users. To do
this I am connecting to a database under the postgres user. The following is
some of the code being used.

$dataSource="dbi:Pg:dbname=alidb";
$dbh = DBI->connect($dataSource, "postgres", "password");
if($dbh)
{      $statement = "CREATE USER oadd WITH PASSWORD rspassword";      #prepare and execute the statment       $sth =
$dbh->prepare($statement);      $rc = $sth->execute;       print "USER HAS BEEN ADDED<br>$ADDstatement<br>";
 
}


Has anyone done this before? If so I could use some guidence because I can't
seem to get it working.

Joe Adams