Good Linux connector for PostgreSQL to C++

(Last Updated On: August 27, 2015)

Good Linux connector forPostgreSQL to C++

NOTE: Video and source code examples posted here https://quantlabs.net/blog/2015/08/postgresql-demo-with-cpp-on-ubuntu-linux/

Please see my video below to walk you through this process

I am now faced with this dilemma. There was a decent one a few years ago for C++ but I need an updated one to keep up with version changes in Postgres. Here is what I found:

http://stackoverflow.com/questions/1138503/good-c-c-connector-library-for-postgresql

http://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm

For the above link: use sudo ./configure (if you have permission access problems so run ‘sudo’ as well)

This is where my pg_hba.conf installed:

./etc/postgresql/9.3/main/pg_hba.conf

Create a PostgreSQL user with password and database to connect with as described here:

http://www.postgresql.org/docs/8.0/static/sql-alteruser.html

Start Postgres as explained here:

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04

In a terminal run:

sudo -i -u postgres
psql


I create a new user within Postgres and update connection changes in the C++ files:

 

New

CREATE USER test WITH PASSWORD ‘test123’;

———

You could also create a database user or table via:

http://www.cyberciti.biz/faq/howto-add-postgresql-user-account/

new Ubuntu Linux users pgtest or pgtest with password Hello123_

In Postgres:
CREATE USER pgtest WITH PASSWORD ‘Hello123_’;
CREATE USER testpg WITH PASSWORD ‘Hello123_’;
CREATE DATABASE testdb
GRANT ALL PRIVILEGES ON DATABASE testdb to testpg;

THen
root@ubuntu:~# su – testpg
testpg@ubuntu:~$ psql -d testdb -U testpg
psql (9.3.9)
Type “help” for help.

testdb=>
Join my FREE newsletter to see how I use PostgreSQL database for trading 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
This entry was posted in Quant Development and tagged , , , on by .

About caustic

Hi i there My name is Bryan Downing. I am part of a company called QuantLabs.Net This is specifically a company with a high profile blog about technology, trading, financial, investment, quant, etc. It posts things on how to do job interviews with large companies like Morgan Stanley, Bloomberg, Citibank, and IBM. It also posts different unique tips and tricks on Java, C++, or C programming. It posts about different techniques in learning about Matlab and building models or strategies. There is a lot here if you are into venturing into the financial world like quant or technical analysis. It also discusses the future generation of trading and programming Specialties: C++, Java, C#, Matlab, quant, models, strategies, technical analysis, linux, windows P.S. I have been known to be the worst typist. Do not be offended by it as I like to bang stuff out and put priorty of what I do over typing. Maybe one day I can get a full time copy editor to help out. Do note I prefer videos as they are much easier to produce so check out my many video at youtube.com/quantlabs