Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/siyovush-hamidov/postgresql-cpp-connector
ποΈThis project showcases a C++ application that connects to a PostgreSQL database to query information. With a simple terminal interface, users can easily retrieve data by entering the prompt.
https://github.com/siyovush-hamidov/postgresql-cpp-connector
cpp devops libpqxx postgres postgresql sql
Last synced: about 2 months ago
JSON representation
ποΈThis project showcases a C++ application that connects to a PostgreSQL database to query information. With a simple terminal interface, users can easily retrieve data by entering the prompt.
- Host: GitHub
- URL: https://github.com/siyovush-hamidov/postgresql-cpp-connector
- Owner: siyovush-hamidov
- Created: 2024-07-10T19:25:05.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-16T06:34:08.000Z (4 months ago)
- Last Synced: 2024-09-16T07:56:39.158Z (4 months ago)
- Topics: cpp, devops, libpqxx, postgres, postgresql, sql
- Language: C++
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ποΈ PostgreSQL C++ Connector π
Welcome to **PostgreSQL with C++: City Explorer**! π This project showcases a simple yet powerful example of how to connect a C++ application to a PostgreSQL database using the `libpqxx` library. With this project, you can explore the 10 largest cities in the USA right from your terminal! π
## Features β¨
- **Easy Setup** π οΈ: Quickly set up and get started with minimal configuration.
- **Simple Interface** π»: Interact with the database through a clean and intuitive terminal interface.
- **Robust Design** ποΈ: Organized code structure with a dedicated PostgreSQL class for easy database management.
- **Educational** π: Perfect for learning how to integrate C++ with PostgreSQL using `libpqxx`.## Why Use This Project? π
- **Learn by Doing** π¨βπ»: Hands-on experience is the best way to learn. This project provides a practical example of database integration.
- **Boost Your Skills** π: Improve your C++ and SQL knowledge by exploring real-world applications.
- **Reusable Code** β»οΈ: The PostgreSQL class can be easily adapted for other projects requiring database interactions.## How to Get Started π
1. **Clone the Repository** π§©:
```bash
git clone https://github.com/siyovush-hamidov/postgresql-cpp-connector.git
cd postgresql-cpp-connector
```2. **Install Dependencies** π¦:
- Make sure you have PostgreSQL and `libpqxx` installed.
- Set up your PostgreSQL server and create the `cities` table with the top 10 largest cities in the USA.3. **Compile the Code** π οΈ:
```bash
g++ -std=c++11 main.cpp PostgresDB.cpp -o connector `pkg-config --cflags --libs libpqxx`
```4. **Run the Program** βΆοΈ:
```bash
./city_explorer
```5. **Explore the Cities** πΊοΈ:
- Enter the city ID to see the city name.
- Type `0` to exit the program.## Additional Resources:
- https://www.postgresql.org/docs/7.2/libpqplusplus.html
- https://www.instaclustr.com/support/documentation/postgresql/using-postgresql/connecting-to-postgresql-with-c-plus-plus/## Contributions Welcome! π€
We love contributions! Feel free to fork the repository and submit pull requests. Let's make this project even better together! π
## License π
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.