Re: Database connectivity using a unix shell

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Database connectivity using a unix shell
Дата
Msg-id 1151597892.13129.16.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Re: Database connectivity using a unix shell  ("Jasbinder Bali" <jsbali@gmail.com>)
Ответы Re: Database connectivity using a unix shell
Список pgsql-general
On Thu, 2006-06-29 at 11:08, Jasbinder Bali wrote:
>
> On 6/29/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
>         On Thu, 2006-06-29 at 10:24, Jasbinder Bali wrote:
> > > Hi
> > > I need to connect to the postgres database using my unix shell.
> > > How should i go about it?
> > > Is libpq going to be helpful here?
>
> > There is a shell interface for postgresql called psql.
>
> > If you have postgresql installed on a box, then the psql interface
> > should be there.
>
> > If you need to access postgresql from within a bash script, you can
> > do So with a construct kinda like this:
>
> > query="select * from sometable";
> > a=`echo $query|psql -tq dbname`;

> in my bash script where and how do i specify the database connection
> parameters

In psql you can use -U to specify your username.  for password info, you
need to use a .pgpass file (i.e. no passwords on the command line).

http://www.postgresql.org/docs/8.1/interactive/libpq-pgpass.html


В списке pgsql-general по дате отправления:

Предыдущее
От: "Jasbinder Bali"
Дата:
Сообщение: Re: Database connectivity using a unix shell
Следующее
От: "Jasbinder Bali"
Дата:
Сообщение: Re: Database connectivity using a unix shell