connect to postgres from shell scripts

Поиск
Список
Период
Сортировка
Искать

connect to postgres from shell scripts

От:
Hemapriya <priyam_1121@yahoo.com>
Дата:
Hi,

I would like to know how to connect to postgres from
shell scripts using a password protected user.

Is there a way to embed the password in psql login.
It keeps prompting for the passwords.

Any hint is appreciated.

Thanks
Priya


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

Re: connect to postgres from shell scripts

От:
Devrim GUNDUZ <devrim@gunduz.org>
Дата:
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-932793750-1124732087=:30926
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-9; FORMAT=flowed
Content-Transfer-Encoding: 8BIT
Content-ID: 

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

Hi,

On Mon, 22 Aug 2005, Hemapriya wrote:

> I would like to know how to connect to postgres from
> shell scripts using a password protected user.
>
> Is there a way to embed the password in psql login.
> It keeps prompting for the passwords.

psql checks for PGUSER, PGPASSWORD, PGHOST, PGPORT, PGDATABASE and some 
other environmental variables. Export relevant values to the parameters.

http://www.postgresql.org/docs/8.0/static/libpq-envars.html

Also there's a .pgpass file thing:

http://www.postgresql.org/docs/8.0/static/libpq-pgpass.html

Regards,
- --
Devrim GUNDUZ
Kivi Bilişim Teknolojileri - http://www.kivi.com.tr
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                      http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDCgzAtl86P3SPfQ4RAo5PAJ9y9Pm7ii8z50ZrSB7Bws1qhQU++gCfUepu
C3ErI3WBVLPIJ8ShVPE29Dk=
=dCI+
-----END PGP SIGNATURE-----
--8323328-932793750-1124732087=:30926--

Re: connect to postgres from shell scripts

От:
"Jason Minion" <jason.minion@sigler.com>
Дата:
Take a look at the .pgpass file, some info at:

http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html

Doing that, your password is still as secure as your .pgpass file,
which hopefully is more secure than your script.



-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Hemapriya
Sent: Monday, August 22, 2005 10:43 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] connect to postgres from shell scripts


Hi,

I would like to know how to connect to postgres from
shell scripts using a password protected user.

Is there a way to embed the password in psql login.
It keeps prompting for the passwords.

Any hint is appreciated.

Thanks
Priya


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Re: connect to postgres from shell scripts

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Devrim GUNDUZ  writes:
> psql checks for PGUSER, PGPASSWORD, PGHOST, PGPORT, PGDATABASE and some 
> other environmental variables. Export relevant values to the parameters.

PGPASSWORD is deprecated because it is insecure on some platforms
(to wit, those where other users can see a process' environment
variables via ps).  The ~/.pgpass file is the recommended way to go.

			regards, tom lane

Re: connect to postgres from shell scripts

От:
Chris Travers <chris@metatrontech.com>
Дата:
Вложения:
Hemapriya wrote:

>Hi,
>
>I would like to know how to connect to postgres from
>shell scripts using a password protected user.
>  
>
psql is the simple way.

>Is there a way to embed the password in psql login.
>It keeps prompting for the passwords.
>
>  
>
Use the .pgpass file to store the password.

Best Wishes,
Chris Travers
Metatron Technology Consulting
FAQ