Thread: Automatic backup with password

Automatic backup with password

From
Zengfa Gao
Date:
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

Re: Automatic backup with password

From
"Han Holl"
Date:
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

Re: Automatic backup with password

From
Neil Conway
Date:
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