can't create db

Hello proggers,

I got a strange problem while creating a database FROM PHP:

I connect from SuSE shell via php to a PG-server [7.3.2] using command
$conn = [at] pg_pconnect("host=db port=5432 user=postgres dbname=template1");
[db is an Alias in /etc/hosts an points to 192.168.0.200]
Then I create a database using command
pg_exec($conn,"CREATE DATABASE dvl_ao_27_beta;");


All works fine!


But when I connect using the IP-adress instead of the alias
$conn = [at] pg_pconnect("host=192.168.0.200 port=5432 user=postgres dbname=template1");
the handle is valid as well, but then if I want to create the database I got the error
ERROR: CREATE DATABASE: source database "template1" is being accessed by other users

Does anybody have an idea what goes wrong in case I use the IP?


Enrico Ortmann

----------------------------------------


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
Enrico Ortmann [ Fr, 16 Januar 2004 11:30 ] [ ID #141587 ]

Re: can't create db

Hi Mariusz,

MP> Thus there may be two connections (two users) to the template1 database.
MP> Just try the same actions with pg_connect.

Thanks, that seems to be the cause of the problem,
'cause I got no errors using pg_connect.

Rico




---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
Enrico Ortmann [ Mo, 19 Januar 2004 09:27 ] [ ID #141592 ]
Datenbanken » gmane.comp.db.postgresql.php » can't create db

Vorheriges Thema: pg_connect(): Cannot create new link
Nächstes Thema: timestamptz Insert