Thread: PostgreSQL connect options?
Once upon a time, I know I saw an example of using connect options to specify things like a user name. I can't find any examples in any of the references now. So what are some of the options and how does one specify them? roland -- Roland B. Roberts, PhD Custom Software Solutions roberts@panix.com 101 West 15th St #4NN New York, NY 10011
On Sat, 1 Aug 1998, Roland Roberts wrote: > Once upon a time, I know I saw an example of using connect options to > specify things like a user name. I can't find any examples in any of > the references now. So what are some of the options and how does one > specify them? You want to do this from within a program? libpq has PQconnectdb(). You can use it like PQconnectdb("dbname=database user=username password=pwd authtype=password"); The perl module has PQconnectdb() too, works the same way. I suppose the other interfaces have similar named functions. Maarten _____________________________________________________________________________ | TU Delft, The Netherlands, Faculty of Information Technology and Systems | | Department of Electrical Engineering | | Computer Architecture and Digital Technique section | | M.Boekhold@et.tudelft.nl | -----------------------------------------------------------------------------
>>>>> "Maarten" == Maarten Boekhold <maartenb@dutepp0.et.tudelft.nl> writes: Maarten> On Sat, 1 Aug 1998, Roland Roberts wrote: [...] Maarten> PQconnectdb("dbname=database user=username password=pwd Maarten> authtype=password"); This is more-or-less what I was looking for. Is there someplace the list of options (i.e., dbname, user, password, etc.) is documented? I'm actually looking to do this from PHP (in apache). So the function I have is pg_connect, which is declared as int pg_connect(string host, string port, string options, string tty, string dbname); So, I'm going to try stuffing the user=username into the options to see if that does what I hope.... roland -- Roland B. Roberts, PhD Custom Software Solutions roberts@panix.com 101 West 15th St #4NN New York, NY 10011
Roland Roberts wrote: > > I'm actually looking to do this from PHP (in apache). So the function > I have is pg_connect, which is declared as > > int pg_connect(string host, string port, string options, > string tty, string dbname); > > So, I'm going to try stuffing the user=username into the options to > see if that does what I hope.... You may use the same syntax in PHP. pg_connect("dbname=database user=username password=pwd authtype=password"); Bye! -- Daniele ------------------------------------------------------------------------------- "Oh, I've seen copies [of Linux Journal] around the terminal room at The Labs." (By Dennis Ritchie) ------------------------------------------------------------------------------- Se telecom italia aggiungesse uno scatto al giorno ad ogni abbonato, dal primo Gennaio avrebbe rubato 676.352.000.000 Lire. ------------------------------------------------------------------------------- Daniele Orlandi - Utility Line Italia - http://www.orlandi.com Via Mezzera 29/A - 20030 - Seveso (MI) - Italy -------------------------------------------------------------------------------