Forum: Ruby PostgreSQL Dump

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Saravanan K. (Guest)
on 2009-03-17 13:36
Hi all,

I'm using  following command to take dump from my sql database.

pg_dump -h localhost -U postgres dbname > dump.sql

Whenever i trying to run this command in command prompt, it always
asking password.

Here my query is,

if i write this command in a separate ruby file how can i give password
in that command.

in my sql, we  can use
mysqldump -h #{host} -u #{user} -p#{pwd} dbname > dump.sql
if use like that it wont ask password anymore. but how is it possible in
postgres.


Thanks in Advance
Saravanan K
Saravanan K. (Guest)
on 2009-03-17 14:27
Saravanan K. wrote:
> Hi all,
>
> I'm using  following command to take dump from my sql database.
>
> pg_dump -h localhost -U postgres dbname > dump.sql
>
> Whenever i trying to run this command in command prompt, it always
> asking password.
>
> Here my query is,
>
> if i write this command in a separate ruby file how can i give password
> in that command.
>
> in my sql, we  can use
> mysqldump -h #{host} -u #{user} -p#{pwd} dbname > dump.sql
> if use like that it wont ask password anymore. but how is it possible in
> postgres.
>
>
> Thanks in Advance
> Saravanan K


Hi folks,,

I fixed that issue thanks
refered link
http://www.postgresql.org/docs/8.1/static/libpq-pgpass.html

Thanks
This topic is locked and can not be replied to.