pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
EXEC SQL CONNECT
3+ messages / 2 participants
[nested] [flat]

* EXEC SQL CONNECT
@ 1999-01-21 03:09  James Thompson <jamest@math.ksu.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: James Thompson @ 1999-01-21 03:09 UTC (permalink / raw)
  To: pgsql-interfaces


Hi,

The mail archive seems messed up when I search for this info.

I'm trying to use ecpg to connect to postgres

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.

I tried looking in the preproc.y filebut I don't understand it's format.

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson    138 Cardwell Hall  Manhattan, Ks   66506    785-532-0561 
Kansas State University                          Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [INTERFACES] EXEC SQL CONNECT
@ 1999-01-21 08:31  Michael Meskes <Michael_Meskes@usa.net>
  parent: James Thompson <jamest@math.ksu.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Meskes @ 1999-01-21 08:31 UTC (permalink / raw)
  To: James Thompson <jamest@math.ksu.edu>; +Cc: pgsql-interfaces

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!



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [INTERFACES] EXEC SQL CONNECT
@ 1999-01-27 04:26  James Thompson <jamest@math.ksu.edu>
  parent: Michael Meskes <Michael_Meskes@usa.net>
  0 siblings, 0 replies; 3+ messages in thread

From: James Thompson @ 1999-01-27 04:26 UTC (permalink / raw)
  To: Michael Meskes <Michael_Meskes@usa.net>; +Cc: pgsql-interfaces

On Thu, 21 Jan 1999, Michael Meskes wrote:

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

Very Good.  Impressive package.  It's handled everything I've thrown at it
without complaints.  I couldn't get the whenever not found goto label: to
parse but was able to get around it with a break.  I'm willing to bet it
was a "it's late and I'm tired" error on my part so I'll try again later.

Do you have any docs on the supported functions.  I've been trying to use
a Pro*C on-line manual but the differences keep tripping me up.  I'm
interested in the actions to whenever sqlerror.  I tried to look in the
preproc.y file but I have no idea what I'm looking at.  I saw a DO and a
CALL but can't find out what they mean.

Also, does ecpg support any form of dynamic SQL?  If not, can ecpg coexist
with libpg code in the same function?

TIA

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson    138 Cardwell Hall  Manhattan, Ks   66506    785-532-0561 
Kansas State University                          Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~1999-01-27 04:26 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-01-21 03:09 EXEC SQL CONNECT James Thompson <jamest@math.ksu.edu>
1999-01-21 08:31 ` Michael Meskes <Michael_Meskes@usa.net>
1999-01-27 04:26   ` James Thompson <jamest@math.ksu.edu>

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