From: Yasir Malik <ymalik@cs.stevens.edu>
To: Mauro Bertoli <bertolima@yahoo.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: PHP postgres connections
Date: Fri, 29 Apr 2005 23:47:48 -0400 (EDT)
Message-ID: <Pine.NEB.4.62.0504292345270.22644@pink-elephant.cs.stevens-tech.edu> (raw)
In-Reply-To: <20050429163134.69632.qmail@web25605.mail.ukl.yahoo.com>
References: <20050429163134.69632.qmail@web25605.mail.ukl.yahoo.com>
> Hi,
> I need to connect to 2 differents Postgres 8.0.0
> databases located in the same machine using the same
> PHP script with an "db wrapper object" instance
> (pg_Connect)... simply a PHP page with contemporarily
> 2 database connections...
>
I don't think this is the right place to ask this, but there's an example
on php.net for using the pg_connect():
<?php
$dbconn = pg_connect("dbname=mary");
//connect to a database named "mary"
$dbconn2 = pg_connect("host=localhost port=5432 dbname=mary");
// connect to a database named "mary" on "localhost" at port "5432"
$dbconn3 = pg_connect("host=sheep port=5432 dbname=mary user=lamb
password=foo");
//connect to a database named "mary" on the host "sheep" with a username
and password
$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar";
$dbconn4 = pg_connect($conn_string);
//connect to a database named "test" on the host "sheep" with a username
and password
?>
I don't know if that answers your question.
> Can I use however persistent connections ?
>
pg_pconnect() works the same way.
Regards,
Yasir
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: ymalik@cs.stevens.edu, bertolima@yahoo.it
Subject: Re: PHP postgres connections
In-Reply-To: <Pine.NEB.4.62.0504292345270.22644@pink-elephant.cs.stevens-tech.edu>
References: <20050429163134.69632.qmail@web25605.mail.ukl.yahoo.com> <Pine.NEB.4.62.0504292345270.22644@pink-elephant.cs.stevens-tech.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox