pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Meskes <Michael_Meskes@usa.net>
To: James Thompson <jamest@math.ksu.edu>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: [INTERFACES] EXEC SQL CONNECT
Date: Thu, 21 Jan 1999 09:31:17 +0100
Message-ID: <19990121093117.A2863@gmx.net> (raw)
In-Reply-To: <Pine.GSO.4.05.9901202104070.19628-100000@noether.math.ksu.edu>
References: <Pine.GSO.4.05.9901202104070.19628-100000@noether.math.ksu.edu>

On Wed, Jan 20, 1999 at 09:09:59PM -0600, James Thompson wrote:
> I'm trying to use ecpg to connect to postgres

Good. :-)

> I've never used embedded sql in C though years ago I did use Pro*FORTRAN
> for Oracle.  Anyway how do I connect to a remote or local database in ecgs
> passing in the database name, username, and password.  The test programs
> in the tarball don't seem to do this.

The following is accepted syntax:

exec sql connect to <database name> [as <connection name>] [user <user name>]
exec sql connect to default
exec sql <user name>

As for the database name you can choose two different sets of syntax:

new style:
<tcp|unix>:postgresql://server[:port][/dbname][?options]

old style:
style: dbname[@server][:port] 

Finally the user name can be written as:

<user>
<user>/<password>
<user> identified by <password>
<user> using <password>

Hope this helps.

Michael

-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!



view thread (3+ messages)  latest in thread

Message-ID: <19990121093117.A2863@gmx.net>
Permalink:  ../19990121093117.A2863@gmx.net/
Also on:    postgresql.org/message-id/19990121093117.A2863@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: Michael_Meskes@usa.net, jamest@math.ksu.edu
  Subject: Re: [INTERFACES] EXEC SQL CONNECT
  In-Reply-To: <19990121093117.A2863@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox