Chapter 8. Accessing Databases

In this chapter, we will cover the following recipes:

  • Setting up SQL Driver for Qt
  • Connecting to a database
  • Writing basic SQL queries
  • Creating a login screen with Qt
  • Displaying information from a database on a model view
  • Advanced SQL queries


SQL stands for Structured Query Language, a special programming language used to manage data held in a relational database management system. A SQL server is a database system designed to use one of the many types of SQL programming language to manage its data.


If you want to learn more about SQL, visit this link:

Qt supports several different types of SQL driver in the form of plugins/add-ons. However, it's very easy to integrate ...

Get Qt5 C++ GUI Programming Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.