C++ and Databases: A Practical Guide
300 pages
English
PDF
4.5

C++ and Databases: A Practical Guide

C++ and Databases: A Practical Guide

Author:

Year:

Summary:

The book "C++ and Databases: A Practical Guide" is a comprehensive textbook for developers who want to master working with relational databases in the C++ environment. The author, Alexey Voronov, a senior developer with 15 years of experience, shares proven approaches and real-world cases from commercial development.



What is this book about?

You will learn how to design databases, write efficient SQL queries, and integrate them into C++ applications. The book covers all popular DBMS: SQLite (for embedded solutions), PostgreSQL and MySQL (for server projects), as well as working through the universal ODBC interface. Special attention is paid to:

  • Connecting to databases from C++ (libraries libpq, mysql-connector-cpp, sqlite3).
  • Executing queries, processing results, and managing transactions.
  • Creating custom ORM-like wrappers to simplify work.
  • Performance optimization: connection pools, caching, indexes.
  • Protection against SQL injection and safe handling of user data.


Who is this book for?

  • Junior developers — will learn how to properly organize data storage in C++ projects.
  • Middle and Senior developers — will find advanced techniques, examples of asynchronous work, and fine-tuning.
  • Students and teachers — will get structured material for coursework and lab assignments.
  • Freelancers and entrepreneurs — will be able to quickly integrate databases into their products.


What will you learn?

  • Design normalized database schemas.
  • Use C++ for inserting, updating, and retrieving data.
  • Work with transactions and isolation levels.
  • Create multithreaded applications with shared database access.
  • Test code that works with databases.
  • Migrate between DBMS without rewriting code.


All code examples are available for download and have been tested on Windows, Linux, and macOS. The book is written in a lively style, with minimal fluff and maximum practice. After reading it, you will be able to confidently add databases to any C++ project — from a console utility to a high-load server.



Bonus: at the end of the book — a reference guide to the main functions of the SQLite, PostgreSQL, and MySQL libraries, as well as a checklist for auditing your application's security.

Recommendations