0

What is the best way to connect from C++ to a postgressql server? An important limitation is that there can't be any additional software installations (some .exe or .misi files that install the driver). Furthermore, all configuration must be done through the C++ application.

Is there some library that can be bundled as a .dll or as .h and .cpp source files? The library/driver must also work on Linux.

1 Answer 1

0

Are you using .NET Framework, or producing unmanaged code? NPGSQL is the most popular Postgres driver for .NET and it works with Entity Framework. It is available on Linux if you are using .NET Core.

Other than that, an ODBC-compliant driver is your best bet. I know for a fact there are ODBC drivers for Postgresql, but I cannot comment on their quality, as I have always used Npgsql. My experiences with Postgresql and JDBC have been very positive, however.

1
  • I have used unmanaged standard compliant C++ code. In the end, I had managed to get my program to connect to Postgressql. Though, I am not entirely sure what did the trick. Luckily, I am done with that project and back to C++ with Microsoft SQL Server.
    – Willi
    Jun 27, 2019 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.