Skip to content

๐Ÿ™๏ธ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.

Notifications You must be signed in to change notification settings

siyovush-hamidov/postgresql-cpp-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ™๏ธ 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 ๐Ÿงฉ:

    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 ๐Ÿ› ๏ธ:

    g++ -std=c++11 main.cpp PostgresDB.cpp -o connector `pkg-config --cflags --libs libpqxx`
  4. Run the Program โ–ถ๏ธ:

    ./city_explorer
  5. Explore the Cities ๐Ÿ—บ๏ธ:

    • Enter the city ID to see the city name.
    • Type 0 to exit the program.

Additional Resources:

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 file for more details.

About

๐Ÿ™๏ธ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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published