MariaDB Connector/ODBC supports the built-in ODBC Driver Manager on Windows, so nothing else needs to be installed. The MSI installation process will even take care of registering MariaDB Connector/ODBC with the ODBC Driver Manager, so that it is ready to use immediately.
It is generally a good idea to download and install both the 32-bit and 64-bit MSI packages. Otherwise, the ODBC Driver Manager may sometimes load the wrong version of the driver for your application, which can cause errors like the following:
The installation process is fairly easy. First, you need to extract the files from the binary tarball. Then, you need to install the driver's shared library to the appropriate place in your system. The driver's shared library is called libmaodbc.so and it is located in either the lib directory or the lib64 directory, depending on whether you downloaded a 32-bit or 64-bit package. The driver's shared library can be installed anywhere, but for simplicity, the instructions below will assume that you are installing it to /usr/lib64, which is a common directory for 64-bit shared libraries on many Linux distributions.
Installation steps for some common Linux distributions are shown below. The commands would be similar for other Linux distributions. However, the URL of the package and the installation path may be different.
In order to use MariaDB Connector/ODBC on Linux, you will also need to install a supported Driver Manager. The only Driver Manager that we currently support on Linux is UnixODBC. In most Linux distributions, you can install UnixODBC by using your Linux distribution's package manager.
If you plan to compile an application from source against MariaDB Connector/ODBC and UnixODBC, then you also need the development header files that define the ODBC API function prototypes, ODBC data types, etc. In most Linux distributions, you can install these UnixODBC development files by using your Linux distribution's package manager.
If you need client authentication plugins in a version which does not bundle them with the connector, then you will also need to install MariaDB Connector/C, which installs the client authentication plugins as shared libraries, which can be used by MariaDB Connector/ODBC.
MariaDB Connector/ODBC can be configured to use MariaDB Connector/C's client authentication plugins by setting the PLUGINDIR parameter to the MariaDB Connector/C's plugin directory. The plugin directory can also be specified with the MARIADB_PLUGIN_DIR environment variable.
When you install the client authentication plugins, ensure that they are for the same architecture as your MariaDB Connector/ODBC installation. If your MariaDB Connector/ODBC installation is 64-bit, then you should install 64-bit client authentication plugins. Likewise, if your MariaDB Connector/ODBC installation is 32-bit, then you should install 32-bit client authentication plugins.
Multiple statement execution is not fully supported. This means that if you try to prepare a multi-statement query where one of statements depends on the execution result of one of the previous statements, then it may fail. For example, the following may return an error in some versions:
These errors occur because the pam authentication plugin requires specific client authentication plugins in order to work, and MariaDB Connector/ODBC does not install these plugins. To fix the problem, please install the client authentication plugins.
An error message from Data Direct ODBC drivers for MySQL is shown when trying to connect to MySQL Community Servers database using DataStage ODBC enterprise stage or trying to import the table definition from the same database.IBM Information...
I had tried installing the mysql-connector-odbc_8.0.22-1ubuntu18.04_amd64.deb package and it had complained about not finding the mysql-community-client-plugins package. I tried a few variations of apt-cache search mysql-community-client-plugins to locate this additional package but nothing came up.
I have gone through the following steps to install from the more generic unix files - MySQL :: MySQL Connector/ODBC Developer Guide :: 4.2.2 Installing Connector/ODBC from a Binary Tarball Distribution
The Qt SQL module uses driver plugins to communicate with the different database APIs. Since Qt's SQL Module API is database-independent, all database-specific code is contained within these drivers. Several drivers are supplied with Qt, and other drivers can be added. The driver source code is supplied and can be used as a model for writing your own drivers.
SQLite is the in-process database system with the best test coverage and support on all platforms. Oracle via OCI, PostgreSQL, and MySQL through either ODBC or a native driver are well-tested on Windows and Linux. The completeness of the support for other systems depends on the availability and quality of client libraries.
Note: To build a driver plugin you need to have the appropriate client library for your Database Management System (DBMS). This provides access to the API exposed by the DBMS, and is typically shipped with it. Most installation programs also allow you to install "development libraries", and these are what you need. These libraries are responsible for the low-level communication with the DBMS. Also make sure to install the correct database libraries for your Qt architecture (32 or 64 bit).
The configure script cannot detect the necessary libraries and include files if they are not in the standard paths, so it may be necessary to specify these paths using either driver-specific include and library path variables or CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH. For example, if your MySQL files are installed in C:\mysql-connector-c-6.1.11-winx64 on Windows, then pass the following parameter to double-dash part of configure line:
When you configure drivers in the manner described above, CMake skips any dependency checks and uses the provided paths as is. This is especially useful if the package provides its own set of system libraries that should not be recognized by the build routine.
In some cases it's more convenient to use CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH variables to locate required libraries. You should prefer this method if module needs to set properties for the provided target libraries (e.g. this is required for PostgreSQL and SQLite). For example, you can do this as follows, to locate MySQL:
Due to the practicalities of dealing with external dependencies, only the SQLite plugin is shipped with binary builds of Qt. Binary builds of Qt for Windows also include the ODBC plugin. To be able to add additional drivers to the Qt installation without re-building all of Qt, it is possible to configure and build the qtbase/src/plugins/sqldrivers directory outside of a full Qt build directory. Note that it is not possible to configure each driver separately, only all of them at once. Drivers can be built separately, though.
MariaDB is a fork of MySQL intended to remain free and open-source software under the GNU General Public License. MariaDB intended to maintain high compatibility with MySQL, ensuring a drop-in replacement capability with library binary parity and exact matching with MySQL APIs and commands. Therefore the plugin for MySQL and MariaDB are combined into one Qt plugin.
MySQL has stored procedure support at the SQL level, but no API to control IN, OUT, and INOUT parameters. Therefore, parameters have to be set and read using SQL commands instead of QSqlQuery::bindValue().
You need the MySQL / MariaDB header files, as well as the shared library libmysqlclient. / libmariadb.. Depending on your Linux distribution, you may need to install a package which is usually called "mysql-devel" or "mariadb-devel".
You need to get the MySQL installation files (e.g. MySQL web installer or MariaDB C Connector). Run the installer, select custom installation and install the MySQL C Connector which matches your Qt installation (x86 or x64). After installation check that the needed files are there:
Note: As of MySQL 8.0.19, the C Connector is no longer offered as a standalone installable component. Instead, you can get mysql.h and libmysql.* by installing the full MySQL Server (x64 only) or the MariaDB C Connector.
When you distribute your application, remember to include libmysql.dll / libmariadb.dll in your installation package. It must be placed in the same folder as the application executable. libmysql.dll additionally needs the MSVC runtime libraries which can be installed with vcredist.exe
The Qt OCI plugin supports connecting to Oracle database as determined by the version of the instant client used. This is dependent on what Oracle indicates it supports. The plugin will auto-detect the database version and enable features accordingly.
The Qt OCI plugin supports authentication using external credentials (OCI_CRED_EXT). Usually, this means that the database server will use the user authentication provided by the operating system instead of its own authentication mechanism.
Binary Large Objects (BLOBs) can be read and written, but be aware that this process may require a lot of memory. You should use a forward only query to select LOB fields (see QSqlQuery::setForwardOnly()).
Choosing the option "Programmer" in the Oracle Client Installer from the Oracle Client Installation CD is generally sufficient to build the plugin. For some versions of Oracle Client, you may also need to select the "Call Interface (OCI)" option if it is available.
ODBC is a general interface that allows you to connect to multiple DBMSs using a common interface. The QODBC driver allows you to connect to an ODBC driver manager and access the available data sources. Note that you also need to install and configure ODBC drivers for the ODBC driver manager that is installed on your system. The QODBC plugin then allows you to use these data sources in your Qt applications.
On Windows, an ODBC driver manager is installed by default. For Unix systems, there are some implementations which must be installed first. Note that every end user of your application is required to have an ODBC driver manager installed, otherwise the QODBC plugin will not work.
c80f0f1006