Automatic backup with password

Started by Zengfa Gaoover 23 years ago3 messagesgeneral
Jump to latest
#1Zengfa Gao
zfgao@yahoo.com

Hi,

I am trying to write some code to do automatic backup
for PgSQL with pg_dump tool. For safty reason, I still
want the password protection.

1. I tried to use script:
echo "password" | pg_dump -U ....
2. I tried to use Java process, OutputStream.

But pg_dump force password prompt. I don't find a way
to give pg_dump with code. Does anyone have an idea?

Thanks!

Zengfa

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#2Han Holl
han.holl@prismant.nl
In reply to: Zengfa Gao (#1)
Re: Automatic backup with password

Oa Wed, Dec 11, 2002 at 05:21:29PM +0100, zfgao@yahoo.com wrote:

Hi,

I am trying to write some code to do automatic backup
for PgSQL with pg_dump tool. For safty reason, I still
want the password protection.

1. I tried to use script:
echo "password" | pg_dump -U ....
2. I tried to use Java process, OutputStream.

But pg_dump force password prompt. I don't find a way
to give pg_dump with code. Does anyone have an idea?

This is what Don Libes invented expect for.

Cheers,

Han Holl

#3Neil Conway
neilc@samurai.com
In reply to: Zengfa Gao (#1)
Re: Automatic backup with password

On Wed, 2002-12-11 at 11:21, Zengfa Gao wrote:

I am trying to write some code to do automatic backup
for PgSQL with pg_dump tool. For safty reason, I still
want the password protection.

But pg_dump force password prompt. I don't find a way
to give pg_dump with code. Does anyone have an idea?

Set the PGPASSWORD env var, or use the ~/.pgpass file (in 7.3). For more
info, see:

http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/libpq-envars.html
http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/libpq-files.html

Cheers,

Neil