1
1
mirror of https://github.com/andre-wojtowicz/qt-sql-example.git synced 2024-12-28 18:05:28 +01:00
An exemplary Qt app that connects to SQL server and displays a table from a database
Go to file
2017-09-02 23:11:10 +02:00
res Added project files 2017-09-01 22:53:26 +02:00
src Minors for linux compatibility; 2017-09-02 23:11:10 +02:00
.gitignore Added project files 2017-09-01 22:53:26 +02:00
config.ini Added project files 2017-09-01 22:53:26 +02:00
qt-sql-example.pro Minors for linux compatibility; 2017-09-02 23:11:10 +02:00
README.md Minors for linux compatibility; 2017-09-02 23:11:10 +02:00
screenshot.png Updated screenshot 2017-09-01 23:24:23 +02:00

Qt SQL Example

An exemplary Qt app that connects to SQL server and displays a table from a database. The program was made for educational purposes.

The program was tested on:

  • clients: Windows 10 with Qt 5.9.1, Ubuntu 16.04 with Qt 5.5.1,
  • servers: MySQL Server 5.5.57, Microsoft SQL Server 2008 R2 SP3.

Client config

The program reads config.ini on startup. The file must be located in the app working directory.

SQL database drivers

A comprehensive discussion about SQL database drivers can be found in Qt Documentation.

Windows 10

  • Both Qt driver plugins should be already bundled with Qt SDK.
  • System ODBC driver should be already bundled with Windows.
  • System MySQL driver can be installed by placing libmysql.dll from C API for MySQL (mysqlclient) in the app working directory.

Ubuntu 16.04

Packages with Qt driver plugins and system SQL manager with drivers:

  • MySQL - libqt5sql5-mysql libmysqlclient20,
  • MSSQL/ODBC - libqt5sql5-odbc libodbc1 odbcinst unixodbc msodbcsql*.

* How to install msodbcsql - Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS.