- Hands-On GUI Programming with C++ and Qt5
- Lee Zhi Eng
- 253字
- 2021-08-27 19:00:17
Database Connection
In the previous chapter, we learned how to create a login page from scratch. However, it is not functional yet, as the login page is not connected to a database. In this chapter, you will learn how to connect your Qt application to a MySQL (or MariaDB) database that validates login credentials.
In this chapter, we will cover the following topics:
- Introducing the MySQL database system
- Setting up the MySQL database
- SQL commands
- Database connection in Qt
- Functional login page
We will walk through this chapter in a step-by-step approach to discover the powerful features that come with Qt and allow your application to connect directly to a database without any additional third-party dependencies. Database querying is a huge topic by itself, but we will be able to learn the most basic commands from scratch through examples and practical methods.
Qt supports multiple different types of database systems:
- MySQL (or MariaDB)
- SQLite (version 2 and 3)
- IBM DB2
- Oracle
- ODBC
- PostgreSQL
- Sybase Adaptive Server
Two of the most popular ones are MySQL and SQLite. The SQLite database is usually used offline and it doesn't require any setup as it uses an on-disk file format for storing data. Therefore, in this chapter, we will learn how to set up a MySQL database system instead, and at the same time learn how to connect our Qt application to a MySQL database. The C++ code used to connect to the MySQL database can be reused for connecting to other database systems without many alterations.
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Web開發的貴族:ASP.NET 3.5+SQL Server 2008
- Python王者歸來
- Scientific Computing with Scala
- Learning JavaScript Data Structures and Algorithms
- Nginx Lua開發實戰
- C#開發案例精粹
- Babylon.js Essentials
- Mastering Web Application Development with AngularJS
- Visual Basic 6.0程序設計實驗教程
- Java程序設計與項目案例教程
- Illustrator CS6設計與應用任務教程
- 小程序從0到1:微信全棧工程師一本通
- Unity Android Game Development by Example Beginner's Guide
- Mastering SciPy