Mysql Odbc 8.0 Unicode Driver Windows 10

0 views
Skip to first unread message

Canumil Flowers

unread,
Jun 30, 2024, 8:16:16 AM6/30/24
to chipzetscase

When I look at the ODBC Data Source Administrator on my desktop (where the query fails), the drivers tab shows 2 MySQL drivers: MySQL ODBC 5.3 ANSI Driver and MySQL ODBC 5.3 Unicode Driver. I tried uninstalling the MySQL drivers and installing the latest MySQL drivers with the same error.

Sounds like a bug in Toad Data Point. We bundle our own mySQL drivers, so the error you are getting should not be a problem. What version are you using? Can you download the latest Toad Data Point, which is 4.1?

Yes, I am attempting to run the query in TDP. Yes, windows is a 64 bit version. I did uninstall the MySQL ODBC drivers, and installed the 64 bit MySQL ODBC drivers. The download file is entitled: mysql-connector-odbc-5.3.7-winx64. Do you think I need to reinstall using a different file?

The host company have suggested I use Putty to create an SSH tunnel and port forward. But I assume this means I need putty running all the time. Not ideal as this is a service - not a user interactive system

The web server is running magneto with a locally hosted mysql dB.
In the office we run windows servers with ms sql databases.
With the current web host I use an odbc connection to allow the ms sql server to query the MySQL db- updating products and getting orders.

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.

When connecting to an ODBC datasource, you should pass the name of the ODBC datasource (DSN) to the QSqlDatabase::setDatabaseName() function, rather than the actual database name. It's also possible to pass a FILEDSN (*.dsn) filename or a complete ODBC driver string. When passing a driver string you must make sure, that all parameters (username, password, ...) are properly escaped. Passing the username or password through the QSqlDatabase functions, the escaping is done by the QODBC plugin.

The QODBC Plugin needs an ODBC compliant driver manager version 2.0 or later. Some ODBC drivers claim to be version-2.0-compliant, but do not offer all the necessary functionality. The QODBC plugin therefore checks whether the data source can be used after a connection has been established, and refuses to work if the check fails. If you do not like this behavior, you can remove the #define ODBC_CHECK_DRIVER line from the file qsql_odbc.cpp. Do this at your own risk!

By default, Qt instructs the ODBC driver to behave as an ODBC 2.x driver. However, for some driver-manager/ODBC 3.x-driver combinations (e.g., unixODBC/MaxDB ODBC), telling the ODBC driver to behave as a 2.x driver can cause the driver plugin to have unexpected behavior. To avoid this problem, instruct the ODBC driver to behave as a 3.x driver by setting the connect option "SQL_ATTR_ODBC_VERSION=SQL_OV_ODBC3" before you open your database connection. Note that this will affect multiple aspects of ODBC driver behavior, e.g., the SQLSTATEs. Before setting this connect option, consult your ODBC documentation about behavior differences you can expect.

With Microsoft SQL Server the result set returned by a stored procedure that uses the return statement, or returns multiple result sets, will be accessible only if you set the query's forward only mode to forward using QSqlQuery::setForwardOnly().

The QPSQL driver automatically detects whether the PostgreSQL database you are connecting to supports Unicode or not. Unicode is automatically used if the server supports it. Note that the driver only supports the UTF-8 encoding. If your database uses any other encoding, the server must be compiled with Unicode conversion support.

Unicode support was introduced in PostgreSQL version 7.1 and it will only work if both the server and the client library have been compiled with multibyte support. More information about how to set up a multibyte enabled PostgreSQL server can be found in the PostgreSQL Administrator Guide, Chapter 5.

d3342ee215
Reply all
Reply to author
Forward
0 new messages