Re: passing passords to pgsql/pg_create/pg_dump programmatically

From: Lars Haugseth <njus(at)larshaugseth(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: passing passords to pgsql/pg_create/pg_dump programmatically
Date: 2007-03-20 14:04:44
Message-ID: 87odmof1tv.fsf@unreal.larshaugseth.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


* "filippo" <filippo2991(at)virgilio(dot)it> wrote:
>
> Hello,
>
> I have written a program perl/Tkprogram, based on postgres. For
> maintenance reasons in my program I use these commands:
>
> `dropdb -U postgres -h $BACKUP_SERVER $BACKUP_DATABASE_NAME`;
> `createdb -U postgres -h $BACKUP_SERVER $BACKUP_DATABASE_NAME`;
> `pg_dump -U postgres -h $DATABASE_SERVER $DATABASE_NAME | psql -
> U postgres -h $BACKUP_SERVER $BACKUP_DATABASE_NAME`;
>
> my @psqlOutput = `psql -l -U postgres -h $_`;
>
>
> my program has a graphic interface but whenever I use these command,
> postgres ask for passord in the command line. How can I give these
> commands the right passowrd programmatically or how can I interact
> with these to give the passwords by a graphic box?

$ dropdb --help
$ createdb --help
$ pg_dump --help

As you can see, all of these command line utilities accept the -W
parameter followed by the password.

Alternatively you can configure PostgreSQL to allow connections
from certain clients without password authentication:

http://www.postgresql.org/docs/8.2/static/client-authentication.html

--
Lars Haugseth

"If anyone disagrees with anything I say, I am quite prepared not only to
retract it, but also to deny under oath that I ever said it." -Tom Lehrer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2007-03-20 14:19:23 Re: passing passords to pgsql/pg_create/pg_dump programmatically
Previous Message Alban Hertroys 2007-03-20 10:45:53 Re: Planner tuning