Re: c++ program to connect to postgre database

From: John R Pierce <pierce(at)hogranch(dot)com>
To: ramon rhey serrano <ramonrheyserrano(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: c++ program to connect to postgre database
Date: 2009-07-09 07:43:48
Message-ID: 4A559FB4.3040805@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

ramon rhey serrano wrote:
> Hi Sir John,
>
> Thanks for the links and reply.
> I downloaded this "libpqxx-3.0" but i really don't know what to do
> with the file and where to put them. I'm still having hard time how to
> start the C++ program using Dev C++ as my IDE, what files do i need to
> install, what headers to use, how the basic flow of program should
> look like (maybe for a simple database connection). I already
> installed PostgreSQL version 1.8.4 in my PC (windows). I have basic
> understanding and background in C++ programming, but totally new to
> PostgreSQL database system.

as I said earlier, I'd probably just use C API calls to libpq, and do my
own C++ wrappings. C++ libraries pretty much have to be compiled for
the speciifc compiler environment, so I'd have to assume youd load the
libpqxx project source into your IDE, and build it.

with libpq, the OS should already have the .so (or dll if you're on
windows), and .h files, so you'd simply #include <libpq-fe.h> and call
the various functions using :: in front of the code to indicate they are
not part of a class. you might have to tell the IDE where the libpq h
and .so files are if they aren't in a standard system library locations
like /usr/include and /usr/lib

I've never used that IDE so I have no idea of the specifics of how you
configure it with new libraries or include files.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message serafin g.segador 2009-07-09 08:24:17 pg_dump PostgreSQL 8.4
Previous Message m_lists 2009-07-09 07:38:56 Re: Performance problem with low correlation data