In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "how C++ connects to PostgreSQL database". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope this article "how C++ connects to PostgreSQL database" can help you solve the problem.
Installation
The latest version of libpqxx can be downloaded from the link: Libpqxx So download the latest version and follow these steps:
Wget http://pqxx.org/download/software/libpqxx/libpqxx-4.0.tar.gztar xvfz libpqxx-4.0.tar.gzcd libpqxx-4.0./configuremakemake install
Shell
Before you start using the PostgreSQL interface of Cmax Candle +, locate the pg_hba.conf file in the PostgreSQL installation directory and add the following line:
# IPv4 local connections:host all all 127.0.0.1/32 md5
Shell
You can start / restart the postgres server and run using the following command:
[root@host] # service postgresql restartStopping postgresql service: [OK] Starting postgresql service: [OK]
Shell
Connect to the PostgreSQL database with Candlespace +
The following C code snippet shows how to connect to an existing database running on the local machine on port 5432. Here, I use the backslash\ line to continue.
# include # include using namespace std;using namespace pqxx;int main (int argc, char* argv []) {try {connection C ("dbname=testdb user=postgres password=cohondob\ hostaddr=127.0.0.1 port=5432"); if (C.is_open ()) {cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.