pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: pgsql-bugs@postgresql.org
Subject: Re: connect to C
Date: Thu, 12 Nov 2015 11:04:17 -0800
Message-ID: <5644E2B1.4030004@hogranch.com> (raw)
In-Reply-To: <CAJWhGX-2iF5jrg+gd3fFtWbCqGTV5MsoQLqpu_q=THjfnKEMrQ@mail.gmail.com>
References: <CAJWhGX-2iF5jrg+gd3fFtWbCqGTV5MsoQLqpu_q=THjfnKEMrQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 11/12/2015 4:11 AM, Hiep Pham wrote:
>  I have a question. Can i connect C program to postgresql in windows? 
> If can, Can you introduce me step by step the way for connecting?


include the libpq-fe.h file, link your program with libpq.dll, and make 
the various libpq calls to connect to the database and issue queries, 
see chapter 31 in the online manual... 
http://www.postgresql.org/docs/current/static/libpq.html

the specific details for how you compile and link are, of course, 
specific to the C compiler toolset you're using.   the required .h and 
.dll files are installed with the postgres installer packages for 
windows, the include file is in D:\PostgreSQL\9.3\include (replace 
prefix with where you installed it), and the dll and .lib file for 
linking are in D:\PostgreSQL\9.3\lib

-- 
john r pierce, recycling bits in santa cruz



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <5644E2B1.4030004@hogranch.com>
Permalink:  ../5644E2B1.4030004@hogranch.com/
Also on:    postgresql.org/message-id/5644E2B1.4030004@hogranch.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pierce@hogranch.com
  Subject: Re: connect to C
  In-Reply-To: <5644E2B1.4030004@hogranch.com>
  References: <CAJWhGX-2iF5jrg+gd3fFtWbCqGTV5MsoQLqpu_q=THjfnKEMrQ@mail.gmail.com> <5644E2B1.4030004@hogranch.com>

* 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