Re: Database connectivity using a unix shell
От | Chris Browne |
---|---|
Тема | Re: Database connectivity using a unix shell |
Дата | |
Msg-id | 60d5crx19x.fsf@dba2.int.libertyrms.com обсуждение исходный текст |
Ответ на | Database connectivity using a unix shell ("Jasbinder Bali" <jsbali@gmail.com>) |
Список | pgsql-general |
jsbali@gmail.com ("Jasbinder Bali") writes: > in my bash script where and how do i specify the database connection > parameters There are three ways: 1. You can store them in environment variables: PGDATABASE=my_database PGPORT=8901 PGUSER=superman PGHOST=some.host.somewhere export PGDATABASE PGPORT PGUSER PGHOST 2. You can specify them in command line parameters: psql -h some.host.somewhere -p 8901 -U superman -d my_database 3. You could specify a service name PGSERVICE=my_fave_db psql where the pg_service.conf in your PostgreSQL installation contains an entry: [my_fave_db] dbname=my_database user=superman host=some.host.somewhere port=8901 4. You can mix these; perhaps start by having PGSERVICE provide part of the information, then environment variables may add to/override some of that, then command line parameters may add to/override further... For a lot of our production environments, we have set up a big, comprehensive pg_service.conf file; local accounts then pick favorite values for PGSERVICE... -- let name="cbbrowne" and tld="acm.org" in String.concat "@" [name;tld];; http://cbbrowne.com/info/lsf.html "Why use Windows, since there is a door?" -- <fachat@galileo.rhein-neckar.de> Andre Fachat
В списке pgsql-general по дате отправления: