Re: accessing postgres from c++

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Rino Mardo <rino19ny(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: accessing postgres from c++
Date: 2022-06-21 05:59:40
Message-ID: d5161927b0fd2abf1f8981c691acae706c26f3a0.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2022-06-21 at 10:56 +0800, Rino Mardo wrote:
> hi. i found odbc.postgresql.org when i was looking for a way to hook up my c++ project to postgresql server.
> installed it and tested to be successful in connection. this was when i had postgresql
> running from a virtualbox vm in Ubuntu. 
>
> i installed a postgresql container using Docker for Windows in my laptop. from a Windows terminal i can
> connect to the postgresql container and from there use psql client to create database.
>
> when postgresql was running in an Ubuntu vm in virtualbox, i wasn't able to test the c++ connection.
> now i want to but can't find a way how. either from python or any programming language.
>
> i guess my problem is more of the programming than db server side but i thought to try asking here
> in case someone can help. thanks.

I am surprised that you choose to be fettered by the constraints of a generic API like ODBC.
For me, that only makes sense if you want to be portable to different databases.

I would use the powerful C API of libpq, or, if you want some C++ boilerplate around it,
use libpqxx.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2022-06-21 07:07:09 Re: accessing postgres from c++
Previous Message Aditya Bhardwaj 2022-06-21 05:51:26 How to use 32 bit ODBC driver