fbpx

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 

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!

Subscribe For Latest Updates

Sign up to best of business news, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Join our Private Chat Server for FREE Trading signals for ETH DOGE ADA

Scroll to Top