Re: Connect to postgres from a script using password

From: Devrim GUNDUZ <devrim(at)gunduz(dot)org>
To: Hemapriya <priyam_1121(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Connect to postgres from a script using password
Date: 2004-07-08 16:44:09
Message-ID: Pine.LNX.4.44.0407081935480.9193-100000@emo.org.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On Thu, 8 Jul 2004, Hemapriya wrote:

> Can anyone tell me how to connect to postgres from a
> shell script using password. If i use psql -UUser db
> -W option it prompts for password everytime..
> Is there anyway we can have the password included in
> psql login command.?

Try environmental variables. I use this one:

==========================
export PGPASSWORD=password
export PGUSER=username
psql dbname
==========================

Using ~/.pgpass might be another alternative.

Regards,
- --
Devrim GUNDUZ
devrim~gunduz.org devrim.gunduz~linux.org.tr
http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFA7Xnbtl86P3SPfQ4RAjNZAKDpOVd0wpOu0y3IDYPbq5tG9RFEgACeKDmC
Pgbg6AI0xK3vWh2fW3SCZ8Q=
=1Qfo
-----END PGP SIGNATURE-----

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Stephan Szabo 2004-07-08 16:46:46 Re: Strange scenary.
Previous Message Hemapriya 2004-07-08 16:07:30 Connect to postgres from a script using password