user3716685
user3716685

Reputation: 1

Run PostgreSQL function to db located on Linux, from Windows command line

I'm trying to call PostgreSQL function from windows command line. the Postgres DB located on a Linux VM. I can run the command line but been prompted for password. How can I work around it?

Since the DB is on different VM, I can't modify the pgpass.conf file, it doesn't exist. any other easy way?

Upvotes: 0

Views: 148

Answers (1)

khampson
khampson

Reputation: 15356

You can run psql on Windows to run a SELECT query that calls the function. To prevent psql from prompting for a password, you can set the password in the PGPASSWORD environment variable.

Optionally, for something which is generally considered somewhat more secure, you could use the pgpass file, which on Windows is located in %APPDATA%\postgresql\pgpass.conf and store the password in there. More details on that can be found here: http://www.postgresql.org/docs/9.3/static/libpq-pgpass.html

Upvotes: 1

Related Questions