Devart ODBCMy SQL
Devart ODBCMy SQL
Table of Contents
Part I What's New 1
© 2019 Devart
II ODBC Driver for MySQL
5 Using...................................................................................................................................
in PHP 99
6 Using
...................................................................................................................................
in Python 100
7 Using
...................................................................................................................................
in QlikView 102
8 Using
...................................................................................................................................
in SSIS 106
© 2019 Devart
What's New 1
1 What's New
© 2019 Devart
2 ODBC Driver for MySQL
© 2019 Devart
What's New 3
2 General Information
1. Overview
2. Features
3. Compatibility
4. Requirements
5. Licensing
6. Getting Support
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
2.1 Overview
ODBC Driver for MySQL provides high-performance and feature-rich connectivity solution for
ODBC-based applications to access MySQL databases from Windows, macOS, Linux - both
32-bit and 64-bit.
Full support for standard ODBC API functions and data types implemented in our driver
makes interaction of your database applications with MySQL fast, easy and extremely handy.
Direct connection
© 2019 Devart
4 ODBC Driver for MySQL
Compatibility
ODBC Driver for MySQL supports MySQL database versions:
MySQL servers: 8.0, 6.0, 5.6, 5.5, 5.1, 5.0, 4.1, 4.0, and 3.23
MariaDB up to 10.x
Microsoft Azure Database for MySQL
Google Cloud for MySQL
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
2.2 Features
Direct Connection
Database applications based on our solution get an opportunity to establish connection to
MySQL directly. Direct Connection gives your applications an unrivaled advantage -
© 2019 Devart
General Information 5
connection to MySQL databases directly via TCP/IP. That improves performance of your
applications, their quality, reliability and especially the deployment process, since there is no
need to supply additional client software together with your application.
ODBC Conformance
Our ODBC driver provides full support for common ODBC interface:
ODBC Data Types support
ODBC API Functions support
In addition, we provide support for Advanced Connection String parameters. Thus allowing
any desktop and web applications to connect to MySQL from various environments and
platforms, that support ODBC.
© 2019 Devart
6 ODBC Driver for MySQL
DB Compatibility
ODBC Driver for MySQL supports the following database servers:
MySQL servers: 8.0, 6.0, 5.6, 5.5, 5.1, 5.0, 4.1, 4.0, and 3.23
MySQL Embedded servers: 6.0, 5.6, 5.5, 5.1, 4.1, and 4.0
MariaDB up to 10.x
High Performance
All our products are designed to help you write high-performance, lightweight data access
layers, therefore they use advanced data access algorithms and techniques of optimization.
Support
Visit our Support page to get instant support from experienced professionals, fast and detailed
responses, user engagement and interaction, frequent builds with bug fixes, and much more.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
2.3 Compatibility
MySQL Compatibility
ODBC Driver for MySQL supports the following database servers:
MySQL servers: 8.0, 6.0, 5.7, 5.6, 5.5, 5.1, 5.0, 4.1, 4.0, and 3.23
© 2019 Devart
General Information 7
MariaDB Compatibility
MariaDB 5.x, MariaDB 10.x
Microsoft Office
© 2019 Devart
8 ODBC Driver for MySQL
Adobe ColdFusion
Open Office
Crystal Reports
QlikView
PHP
Python
Power BI
Dundas BI
Tableau
Qlik Sense
TIBCO Spotfire
PowerBASIC
SAS JMP
Omnis Studio
DBeaver
FileMaker
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
© 2019 Devart
General Information 9
2.4 Requirements
In Direct Mode ODBC Driver for MySQL interacts with MySQL directly via TCP/IP. So you
don't need to install any additional software when working with MySQL in Direct Mode.
Below you can see the requirements:
If you use MySQL Embedded server, you need the server itself (libmysqld.dll) and
accompanying files like errmsg.sys.
If you are working not in Direct Mode, you need the client library (libmysql.dll).
Important condition is that only one ODBC Driver for MySQL version can be installed on the
PC in order to avoid incompatibility.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
2.5 Licensing
INTRODUCTION
This Devart end-user license agreement ("Agreement") is a legal agreement between you
(either an individual person or a single legal entity) and Devart, for the use of the ODBC Driver
software application, demos, intermediate files, printed materials, and online or electronic
documentation contained in this installation file. For the purpose of this Agreement, the
software program(s) and supporting documentation will be referred to as the "Software".
LICENSE
1. GRANT OF LICENSE
The enclosed Software is licensed, not sold. You have the following rights and privileges,
subject to all limitations, restrictions, and policies specified in this Agreement.
© 2019 Devart
10 ODBC Driver for MySQL
1.1. If you are a legally licensed user, depending on the license type specified in the
registration letter you have received from Devart upon purchase of the Software:- the
"Desktop License" allows you to install and use the Software on a single desktop computer,
provided it is accessed by no more than one person at a time, either directly or remotely, for
sole purposes only in accordance with this Agreement. If more than one person can
simultaneously use the computer where you plan to install the product,you must purchase a
Server License. A Desktop License is valid for one single desktop installation;
- the "Server License" allows you to install and use the Software on a single server,provided it
is accessed by more than one person at a time, either directly or remotely.This definition
includes, but is not limited to, Web servers, application servers,batch servers, and desktop
workstations, where more than one concurrent users can access the Software. A Server
License is valid for one single server installation,provided it is used by 1 (one) legal entity in
accordance with this Agreement.
1.2. If you are a legally licensed user of the Software, you are also entitled to:- make one copy
of the Software for archival purposes only, or copy the Software onto the hard disk of your
computer and retain the original for archival purposes;- develop and test Applications with the
Software, subject to the Limitations below.
1.3. You are allowed to use evaluation versions of the Software as specified in the Evaluation
section.
2. LIMITATIONS
Only legally registered users are licensed to use the Software, subject to all of the conditions
of this Agreement. Usage of the Software is subject to the following restrictions.
2.1. You may not reverse engineer, decompile, or disassemble the Software.
2.2. You may not reproduce or distribute any Software documentation without express written
permission from Devart.
2.3. You may not distribute and sell any portion of the Software integrating it into your
Applications.
© 2019 Devart
General Information 11
2.4. You may not transfer, assign, or modify the Software in whole or in part. In particular, the
Software license is non-transferable, and you may not transfer the Software installation
package.
2.5. You may not remove or alter any Devart's copyright, trademark, or other proprietary rights
notice contained in any portion of Devart files.
3. REDISTRIBUTION
The license grants you a non-exclusive right to reproduce any new software
programs(Applications) created using the Software. You cannot distribute the Software
integrated into your Applications. Any Devart's files remain Devart's exclusive property.
4. TRANSFER
You may not transfer the Software to any individual or entity without express written
permission from Devart. In particular, you may not share copies of the Software under
"Desktop License" with other co-developers without obtaining proper license of these copies
for each individual; you may not install the Software under "Server License" more than 1 (one)
server without obtaining proper license of these installations for each server.
5. TERMINATION
Devart may immediately terminate this Agreement without notice or judicial resolution in the
event of any failure to comply with any provision of this Agreement. Upon such termination
you must destroy the Software, all accompanying written materials, and all copies.
6. EVALUATION
Devart may provide evaluation ("Trial") versions of the Software. You may transfer or
distribute Trial versions of the Software as an original installation package only.If the Software
you have obtained is marked as a "Trial" version, you may install and use the Software for a
period of up to 30 calendar days from the date of installation(the "Trial Period"), subject to the
additional restriction that it is used solely for evaluation of the Software and not in conjunction
with the development or deployment of any application in production. You may not use
Applications developed using Trial versions of the Software for any commercial purposes.
Upon expiration of the Trial Period, the Software must be uninstalled, all its copies and all
accompanying written materials must be destroyed.
© 2019 Devart
12 ODBC Driver for MySQL
7. WARRANTY
The Software and documentation are provided "AS IS" without warranty of any kind.Devart
makes no warranties, expressed or implied, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose or use.
The Software is sold on a subscription basis. The Software subscription entitles you to
download improvements and enhancement from Devart's web site as they become available,
during the active subscription period. The initial subscription period is one year from the date
of purchase of the license. The subscription is automatically activated upon purchase, and
may be subsequently renewed by Devart, subject to receipt applicable fees. Licensed users
of the Software with an active subscription may request technical assistance with using the
Software over email from the Software development. Devart shall use its reasonable
endeavors to answer queries raised, but does not guarantee that your queries or problems
will be fixed or solved.
Devart reserves the right to cease offering and providing support for legacy IDE versions.
9. COPYRIGHT
The Software is confidential and proprietary copyrighted work of Devart and is protected by
international copyright laws and treaty provisions. You may not remove the copyright notice
from any copy of the Software or any copy of the written materials,accompanying the
Software.
This Agreement contains the total agreement between the two parties and supersedes any
other agreements, written, oral, expressed, or implied.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
This document lists several ways you can find help with using ODBC Driver for MySQL
describes the Priority Support program.
© 2019 Devart
General Information 13
Support Options
There are a number of resources for finding help on installing and using ODBC Driver for
MySQL:
You can find out more about ODBC Driver for MySQL installation or licensing by consulting
Installation and License articles of this manual respectively.
You can get community assistance and technical support on the Community Forum.
You can get advanced technical assistance by ODBC Driver for MySQL developers through
the ODBC Driver for MySQL Priority Support program.
Subscriptions
The ODBC Driver for MySQL Subscription program is an annual maintenance and support
service for ODBC Driver for MySQL users.
Users with a valid ODBC Driver for MySQL Subscription get the following benefits:
Product support through the ODBC Driver for MySQL Priority Support program
Access to new versions of ODBC Driver for MySQL when they are released
Access to all ODBC Driver for MySQL updates and bug fixes
Notifications about new product versions
Priority Support
ODBC Driver for MySQL Priority Support is an advanced product support service for getting
expedited individual assistance with ODBC Driver for MySQL-related questions from the
ODBC Driver for MySQL developers themselves. Priority Support is carried out over email
and has a two business day response policy. Priority Support is available for users with an
active ODBC Driver for MySQL Subscription.
To get help through the ODBC Driver for MySQL Priority Support program, please send an
email to odbc@devart.com describing the problem you are having. Make sure to include the
following information in your message:
© 2019 Devart
14 ODBC Driver for MySQL
If you have any questions regarding licensing or subscriptions, please see the FAQ or
contact sales@devart.com
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
1. Installation
2. Connecting to MySQL
3. Connection String Options
4. Secure Connections
o SSL Connection Description
o SSH Connection Description
o HTTP Tunneling Description
5. Product Activation
6. Sandboxed Apps on macOS
7. Using with iODBC
8. Supported Data Types
9. Supported ODBC API Functions
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
3.1 Installation
ODBC Driver for MySQL currently supports such platforms as: Windows, macOS, Linux,
both 32-bit and 64-bit.
© 2019 Devart
Using ODBC Driver 15
3.1.1 Windows
Installation
1. Download and run the installer executive file.
3. In case if you already have the specified installation folder on the PC or another Driver
version is installed, you will get a warning. Click Yes to overwrite the old files with the
4. On the Select Components page you can select whether to install the 64-bit version of the
driver or not. Clear the check box if you need no 64-bit installation. There is also a check
box on this page, that allows you to select whether to install Help and Manual.
© 2019 Devart
16 ODBC Driver for MySQL
5. In the License Information dialog box, you should select the license type and activate the
product. If you have no activation key, you can select Trial and use the driver for evaluation
purposes.
6. If you have an activation key, select the Activation Key option. Copy the activation key from
the registration email or your Customer Portal account and paste it into the Activation Key
edit box.
© 2019 Devart
Using ODBC Driver 17
7. If you have the activation key file, click the Load Activation Key button and browse to it.
© 2019 Devart
18 ODBC Driver for MySQL
8. Click Next.
See also:
Installation on macOS
Install Linux DEB package
Install Linux RPM package
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
3.1.2 Windows Silent
© 2019 Devart
Using ODBC Driver 19
2. Use the following command-lines to perform the driver silent/very silent installation:
Prerequisites
ODBC Driver for MySQL works under control of an ODBC driver manager. ODBC driver
manager is not distributed along with our driver and must be installed separately.
ODBC Driver for MySQL is compatible with iODBC driver manager.
In case when using other ODBC driver managers, ODBC Driver for MySQL will be installed,
but it will require manual modification of configuration files of these managers.
Installation
1. Download the PKG file from the Devart website.
2. Run the downloaded file and follow the instructions in the wizard.
© 2019 Devart
20 ODBC Driver for MySQL
3. After reading the license agreement, click Agree to proceed with the installation.
© 2019 Devart
Using ODBC Driver 21
4. In the License Information dialog box, you should select the license type and activate the
product. If you have no activation key, you can select Trial and use the driver for evaluation
purposes.
5. If you have an activation key, select the Activation Key option. Copy the activation key from
the registration email or your Customer Portal account and paste it into the Activation Key
edit box.
© 2019 Devart
22 ODBC Driver for MySQL
6. If you have the activation key file, click the Load Activation Key button and browse to it.
© 2019 Devart
Using ODBC Driver 23
7. Click Continue.
8. Click Install.
© 2019 Devart
24 ODBC Driver for MySQL
To activate the driver, perform the steps described in the Product Activation article.
Test connection
After the driver is installed, DSN with the name DEVART_MYSQL is created. You can use it to
test a connection with MYSQL server. For this, perform the following steps:
1. Run the iODBC utility of the required bitness. Find the DEVART_MYSQL section and click
the Configure button:
© 2019 Devart
Using ODBC Driver 25
2. In the appeared dialog, specify the required connection settings and click OK.
© 2019 Devart
26 ODBC Driver for MySQL
3. Now click the Test button to establish a test connection to your data source.
© 2019 Devart
Using ODBC Driver 27
See also:
Installation on Windows
Install Linux DEB package
Install Linux RPM package
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
3.1.4 Linux DEB Package
Prerequisites
ODBC Driver for MySQL works under control of an ODBC driver manager. ODBC driver
manager is not distributed along with our driver and must be installed separately.
ODBC Driver for MySQL is compatible with UnixODBC driver manager.
In case when using other ODBC driver managers, ODBC Driver for MySQL will be installed,
© 2019 Devart
28 ODBC Driver for MySQL
Installation
Let's consider how to install the Devart ODBC driver on Linux from a DEB package, for
example, on Ubuntu. There are two ways to install the driver either manually or via the
command line.
GUI installation
1. Download the DEB package of the required bitness from the Devart website.
2. Navigate to the folder with the downloaded package ("Downloads" by default) and double-
click it.
4. If the installation is successfully completed, the Install button changes into the Remove
© 2019 Devart
Using ODBC Driver 29
one.
Command-line installation
1. Download the DEB package from the Devart website.
By default the required package will be downloaded into the ~/Downloads folder (or the
selected one);
3. Navigate to the folder with the downloaded package cd ~/Downloads (if you downloaded
the package into another folder, you need to specify the path to this folder as the cd
command parameter):
cd ~/Downloads/
© 2019 Devart
30 ODBC Driver for MySQL
To activate the driver, perform the steps described in the Product Activation article.
Test connection
After the driver is installed, a DSN with the name DEVART_MYSQL is created. You can use it
to test connection with MYSQL server. For this, perform the following steps:
1. Open the odbc.ini file located in the /etc folder. Find the DEVART_MYSQL section and
specify the required connection settings:
User ID=<your MySQL User Name>
Password=<your MySQL password>
Server=<your MySQL server address>
Port=<your MySQL Port>
Database=<your MySQL database name>
2. Run the UnixODBC Test Command utility and test a connection using the following
command:
isql -v DEVART_MYSQL
© 2019 Devart
Using ODBC Driver 31
See also:
Install Linux RPM package
Installation on Windows
Installation on macOS
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
3.1.5 Linux RPM Package
Prerequisites
ODBC Driver for MySQL works under control of an ODBC driver manager. ODBC driver
manager is not distributed along with our driver and must be installed separately.
ODBC Driver for MySQL is compatible with UnixODBC driver manager.
In case when using other ODBC driver managers, ODBC Driver for MySQL will be installed,
but it will require manual modification of configuration files of these managers.
Installation
Let's consider how to install the Devart ODBC driver on Linux from an RPM package, for
example, on CentOS. To install the driver, you should download the .rpm package and install
© 2019 Devart
32 ODBC Driver for MySQL
it via the command line. See the detailed description of these steps below:
1. Download the RPM package from the Devart website.
By default the required package will be downloaded into the ~/Downloads folder (or the
selected one);
3. Navigate to the folder with the downloaded package cd ~/Downloads (if you downloaded
the package into another folder, you need to specify the path to this folder as the cd
command parameter):
cd ~/Downloads/
To activate the driver, perform the steps described in the Product Activation article.
Test connection
After the driver is installed, a DSN with the name DEVART_MYSQL is created. You can use it
to test connection with MYSQL server. For this, perform the following steps:
© 2019 Devart
Using ODBC Driver 33
1. Open the odbc.ini file located in the /etc folder. Find the DEVART_MYSQL section and
specify the required connection settings:
User ID=<your MySQL User Name>
Password=<your MySQL password>
Server=<your MySQL server address>
Port=<your MySQL Port>
Database=<your MySQL database name>
2. Run the UnixODBC Test Command utility and test a connection using the following
command:
isql -v DEVART_MYSQL
See also:
Install Linux DEB package
Installation on Windows
Installation on macOS
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
1. After the driver is installed, it can be configured. For this, in the Control Panel open
Administrative Tools and find the Data Sources (ODBC) tool:
© 2019 Devart
34 ODBC Driver for MySQL
2. Now you have to add the ODBC Driver for MySQL to the list of System Data Sources or
User Data Sources or File Data Sources using the ODBC Data Source Administrator
dialog.
3. For this, click the Add button - the Create New Data Source dialog will appear with a list
of available drivers.
© 2019 Devart
Using ODBC Driver 35
4. To activate the driver via ODBC Administrator, refer to the Product Activation article for
more details.
5. In the appeared connection dialog, you can set the connection options.
© 2019 Devart
36 ODBC Driver for MySQL
6. Then you can click OK and finish configuration or switch to the Advanced settings tab to
specify more detailed Connection String. See the full list of supported connection string
options in the Connection Options article.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
Option Description
Server Serves to supply the server name for login.
Port Used to specify the port number for the connection. 3307 by default.
User ID Used to supply a user name for login.
Password Used to supply a password for login.
© 2019 Devart
Using ODBC Driver 37
Advanced Settings
Option Description
Allow NULL
To retrieve metadata, not all parameters according to MSDN can accept a
strings
null value. If NULL, the driver should return an error. But some 3rd-party
Empty
tools pass NULL to the parameters. These options should be enabled for
strings as
compatibility with such tools.
NULL
© 2019 Devart
38 ODBC Driver for MySQL
version that a third-party tool expects. The behavior of ODBC driver can
be changed by setting a value for the SQL_ATTR_ODBC_VERSION
attribute by calling the SQLSetEnvAttr function. But some third-party tools
expect the driver to exhibit ODBC 2.x behavior, but forget to call
SQLSetEnvAttr with the specified version or pass an incorrect value there.
Behavior In this case, the required behavior can be explicitly specified in the
Connection String by setting the ODBC Behavior parameter. The possible
values are:
Default - default ODBC behavior determined by a third-party tool.
Ver 2.x - ODBC 2.x behavior is explicitly set.
Ver 3.x - ODBC 3.x behavior is explicitly set.
Used to specify the number of seconds that the execution of an SQL query
Query
can take before it is terminated and an exception is raised. If the value is
Timeout
0, no timeout will happen. The default value is 0.
RegionalNu
mberSetting Enables using local regional settings when converting numbers to string.
s
RegionalDat
Enables using local regional settings when converting dates and times to
eTimeSettin
string.
gs
Sets the string value types returned by the driver as Default, Ansi or
Unicode.
Default - the driver defines the string types.
Ansi - all string types will be returned as SQL_CHAR, SQL_VARCHAR
and SLQ_LONGVARCHAR.
String Types
Unicode - all string types will be returned as SQL_WCHAR,
SQL_WVARCHAR and SLQ_WLONGVARCHAR.
The option value should be changed if any third-party tool supports only
Ansi string types or Unicode ones.
© 2019 Devart
Using ODBC Driver 39
See also:
SSL Connection Description
SSH Connection Description
HTTP Tunneling Description
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
© 2019 Devart
40 ODBC Driver for MySQL
SSL client authentication allows a server to confirm a user's identity. Using the same
techniques as those used for server authentication, SSL-enabled server software can
check that a client's certificate and public ID are valid and have been issued by a certificate
authority (CA) listed in the server's list of trusted CAs. This confirmation might be important
if the server, for example, is a bank sending confidential financial information to a customer
and wants to check the recipient's identity.
An encrypted SSL connection requires all information sent between a client and a server to
be encrypted by the sending software and decrypted by the receiving software, thus
providing a high degree of confidentiality. Confidentiality is important for both parties to any
private transaction. In addition, all data sent over an encrypted SSL connection is protected
with a mechanism for detecting tampering--that is, for automatically determining whether
the data has been altered in transit.
SSL is based on algorithms of asymmetric encryption and digital signature. Consult MySQL
Reference Manual for information about how to enable SSL support for MySQL server and
generate certificates .
Note:
Usage of SSL is more preferable for MySQL connections than SSH because of less
required settings and higher performance.
© 2019 Devart
Using ODBC Driver 41
© 2019 Devart
42 ODBC Driver for MySQL
This connection method provides secure connection between your application using ODBC
Driver for MySQL and SSH server that can go through insecure communication channels, like
Internet.
Connections between DB server and SSH server are insecure, therefore they should go
through secure communication channels. In the confluent case, DB server and SSH server
can be located on the same computer.
The principle of working of the SSH connections is described below. The SSH server listens
to the specified TCP/IP port. When the client tries to connect to this port, the SSH server
authenticates the client. If the authentication passes, the connection is established. Then the
client should create connections to DB server objects. The client sends an inquiry to establish
necessary connection to SSH server, and the server establishes it.
© 2019 Devart
Using ODBC Driver 43
Note:
There is no need to install SSH client, since ODBC Driver for MySQL itself implements
SSH client functionality.
About the methods of higher protection (key authentication, etc.) see documentation for
OpenSSH.
© 2019 Devart
44 ODBC Driver for MySQL
Option Description
Use SSH Enables or disables SSH tunneling.
Holds the host name or IP address of the
SSH Host name
SSH server to connect to.
Used to specify the port number for SSH
SSH Port
connection.
SSH User Name Sets the SSH user name for authentication.
Sets the SSH user password for
SSH Password
authentication.
Used to specify the path to the file
containing the SSH Private Key.
If the authentication by key is used, the user
must have his pair of keys. The public key
should be transferred to the server, while
the private key will be used by the client to
SSH Client Key
sign data,
that will be used by server to authenticate
the user. The server verifies the specified
user name and Private Key - and if the
Server Key corresponds to this user,
connection may be established.
Used to specify the path to the file that
SSH Server Key
contains SSH Public Key.
Used to specify the path to the directory
SSH StoragePath
where encyption keys are stored.
© 2015-2019
Request Support ODBC Forum Provide Feedback
Devart. All Rights
© 2019 Devart
Using ODBC Driver 45
Reserved.
3.4.3 HTTP Tunneling Description
© 2019 Devart
46 ODBC Driver for MySQL
© 2019 Devart
Using ODBC Driver 47
Http=true;Url=http://server/tunnel.php;Http Username=HttpUser;Http
Password=HttpPassword;
© 2019 Devart
48 ODBC Driver for MySQL
account.
Additional information
Technically speaking, there is one more way to tunnel network traffic. The Secure Shell
forwarding, or SSH, can be used for forwarding data. However, main purpose of SSH is traffic
encryption rather than avoiding firewalls or network configuration problems. The SSH
Connection article describes how to use SSH protocol in ODBC Driver for MySQL.
Keep in mind that traffic tunneling or encryption always increase CPU usage and network
load. It is recommended that you use direct connection whenever possible.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
© 2019 Devart
Using ODBC Driver 49
account.
4. To login to the Customer Portal, use your Username and Password from the registration
email.
5. To obtain your Activation Key, click the View link on the right. You will get the following
dialog box:
See also:
Activation on Windows
Activation on MacOS
Activation on Linux
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
3.5.2 Activation on Windows
© 2019 Devart
50 ODBC Driver for MySQL
3. In the appeared dialog box, select the installed driver, click Finish.
© 2019 Devart
Using ODBC Driver 51
4. In the Driver Configuration dialog box, on the License tab, click the Input Activation Key
button.
© 2019 Devart
52 ODBC Driver for MySQL
5. Copy the activation key from the registration email carefully and paste it into the Input
6. If you have the activation key file, click the Load Key button and browse to it.
7. Click OK.
© 2019 Devart
Using ODBC Driver 53
2. Copy the activation key from the registration email or your Customer Portal account and
3. Place the "activation.key" file into the folder where the driver was installed (for Devart
See also:
Activation on Windows
Activation on Linux
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
3.5.4 Activation on Linux
2. Copy the activation key from the registration email or your Customer Portal account and
3. Place the "activation.key" file into the folder where the driver was installed (for Devart
See also:
© 2019 Devart
54 ODBC Driver for MySQL
Activation on Windows
Activation on macOS
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
3.5.5 Where to See the License Information?
2. Open the System DSN tab and click the Add button
© 2019 Devart
Using ODBC Driver 55
© 2019 Devart
56 ODBC Driver for MySQL
See also
Product Activation
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
In the context of ODBC drivers, sandboxed applications don’t have permission to access
iODBC Driver Manager on macOS. When retrieving data from a database into an application
such as Excel via ODBC Driver for MySQL on macOS, you may get an error message
saying that the driver is unable to create a file.
Note that all third-party apps distributed through the Mac App Store are sandboxed.
© 2019 Devart
Using ODBC Driver 57
After reboot, your Mac start will SIP disabled and you’ll be able to fetch data through an ODBC
driver without any errors. You can check the status of SIP by entering csrutil status in the
Terminal. The message should say: "System Integrity Protection status: disabled".
© 2019 Devart
58 ODBC Driver for MySQL
Don’t forget to re-enable SIP when you finish retrieving data into a third-party application from
an ODBC source. You can turn on SIP by following the above instructions and typing in
csrutil enable at step 4.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
For this reason, we recommend using the following data types instead:
SQL_CHAR
SQL_VARCHAR
SQL_LONGVARCHAR
© 2019 Devart
Using ODBC Driver 59
ODBC Driver for MySQL supports all the MySQL data types.
The complete list of MySQL data types is available in the MySQL documentation.
© 2019 Devart
60 ODBC Driver for MySQL
BLOB
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
Important Note:
For backward compatibility, ODBC Driver for MySQL supports all deprecated functions.
The following tables list ODBC Driver for MySQL calls grouped by task:
© 2019 Devart
Using ODBC Driver 61
© 2019 Devart
62 ODBC Driver for MySQL
© 2019 Devart
Using ODBC Driver 63
Prepares an SQL
SQLPrepare ISO 92 statement for later
execution.
Assigns storage for
SQLBindParameter ODBC a parameter in an
SQL statement.
Returns the cursor
SQLGetCursorNam name associated
ISO 92
e with a statement
handle.
SQLSetCursorNam Specifies a cursor
ISO 92
e name.
Sets options that
SQLSetScrollOption
ODBC control cursor
s
behavior.
© 2019 Devart
64 ODBC Driver for MySQL
statement.
Used in conjunction
with SQLPutData to
supply parameter
SQLParamData ISO 92
data at execution
time. (Useful for long
data values.)
Sends part or all of a
data value for a
SQLPutData ISO 92
parameter. (Useful
for long data values.)
© 2019 Devart
Using ODBC Driver 65
Returns scrollable
SQLFetchScroll ISO 92
result rows.
Returns scrollable
SQLExtendedFetch Deprecated
result rows.
Positions a cursor
within a fetched
block of data and
enables an
SQLSetPos ODBC application to
refresh data in the
rowset or to update
or delete data in the
result set.
Performs bulk
insertions and bulk
bookmark
SQLBulkOperations ODBC
operations, including
update, delete, and
fetch by bookmark.
© 2019 Devart
66 ODBC Driver for MySQL
Returns additional
diagnostic
information (multiple
SQLGetDiagRec ISO 92
fields of the
diagnostic data
structure).
Returns information
about the optimal set
SQLSpecialColumn
X/Open of columns that
s
uniquely identifies a
row in a specified
© 2019 Devart
Using ODBC Driver 67
© 2019 Devart
68 ODBC Driver for MySQL
Ends statement
processing,
discards pending
results, and,
SQLFreeStmt ISO 92
optionally, frees all
resources
associated with the
statement handle.
Closes a cursor that
SQLCloseCursor ISO 92 has been opened on
a statement handle.
Cancels an SQL
SQLCancel ISO 92
statement.
© 2019 Devart
Using in Third-Party Tools 69
This section describes main principles of using ODBC Driver for MySQL with third-party data
analysis tools:
DBeaver
Microsoft Excel
SQL Server Management Studio (SSMS)
o Troubleshooting in SSMS
OpenOffice and LibreOffice
PHP
Python
QlikView
SSIS
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
DBeaver Overview
DBeaver is a free, open source multiplatform database management tool and SQL client for
developers and database administrators. DBeaver can be used to access any database or
cloud application that has an ODBC or JDBC driver, such as Oracle, SQL Server, MySQl,
Salesforce, or MailChimp. Devart DBeaver provides you with the most important features
you'd need when working with a database in a GUI tool, such as:
SQL queries execution
Metadata browsing and editing
SQL scripts management
Data export/import
Data backup
DDL generation
ER diagrams rendering
Test data generation
BLOB/CLOB support
Database objects browsing
© 2019 Devart
70 ODBC Driver for MySQL
Scrollable resultsets
The tool comes in two editions — Community and Enterprise. Enterprise Edition supports
NoSQL databases, such as MongoDB or Cassandra, persistent query manager database,
SSH tunneling, vector graphics (SVG) and a few other enterprise-level features. Note though
that you can access a MongoDB database from DBeaver Community Edition using the
respective Devart ODBC driver. For the purposes of this guide, we'll use the Community
Edition of DBeaver to retrieve data from MySQL via the Open Database Connectivity driver.
When using ODBC driver for MySQL with DBeaver, SQL_WVARCHAR data types may be
displayed incorrectly in DBeaver. To prevent this, you need to set the string data types to Ansi
either in the Advanced Settings tab of the driver configuration dialog or directly in the
connection string (String Types=Ansi) — all string types will be returned as SQL_CHAR,
SQL_VARCHAR and SQL_LONGVARCHAR.
© 2019 Devart
Using in Third-Party Tools 71
© 2019 Devart
72 ODBC Driver for MySQL
4. Click Test Connection. If everything goes well, you'll see the Success message.
© 2019 Devart
Using in Third-Party Tools 73
If you want to write a custom SQL query that will include only the necessary columns from the
table, you can select New SQL Editor in the SQL Editor main menu. Create your query and
run it by clicking Execute SQL Statement to view the results in the same window.
© 2019 Devart
74 ODBC Driver for MySQL
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
© 2019 Devart
Using in Third-Party Tools 75
2. In the From ODBC dialog, choose your data source name (DSN). If you haven't configured
your ODBC driver yet, you can expand the Advanced Options dialog box and enter the
connection string for your data source (without credentials, which are defined in the
credentials dialog box in the next step). Additionally, you can enter an SQL statement that
will be executed right after establishing a connection to the data source. Click OK.
© 2019 Devart
76 ODBC Driver for MySQL
3. If you're using a database username or password, select Database and enter your
credentials in the dialox bog, then click Connect.
If your database is not password-protected or you've already specified your credentials in the
ODBC data source settings, select Default or Custom and press Connect
© 2019 Devart
Using in Third-Party Tools 77
4. In the window that appears, select the table you want to retrieve data from, and click Load.
The data from the table will be a displayed in an Excel spreadsheet where you can further
work with it.
© 2019 Devart
78 ODBC Driver for MySQL
© 2019 Devart
Using in Third-Party Tools 79
© 2019 Devart
80 ODBC Driver for MySQL
Requirements
In order to avoid incorrect integration with MS SSMS, the working environment must meet the
following conditions:
The data source must be a configured system DSN. Refer to the Driver Configuration
article to learn how to configure a System DSN
The driver, studio, and SQL Server must be of the same bitness. For example, if you are
using 64-bit SQL Server Management Studio on 64-bit Windows platform, then configure
the 64-bit version of the driver using ODBC Administrator launched from %windir%
\system32\odbcad32.exe. Otherwise, configure the driver using the 32-bit version of ODBC
Administrator - launch it from %windir%\SysWOW64\odbcad32.exe.
ODBC Driver for MySQL and SQL Server must be installed on the same computer.
.NET Framework 4.5 must be installed on the computer.
© 2019 Devart
Using in Third-Party Tools 81
and merge them with your SQL Server database. You can create a linked server with one of
these methods: by using the options in the Object Explorer or by executing stored
procedures.
Below are major advantages of using SQL Server Linked Servers to connect to MySQL:
1. The ability to connect other database instances on the same or remote server.
2. The ability to run distributed queries on heterogeneous data sources across the
organization.
3. The ability to work with diverse data sources in the same way.
The linked server will appear under the Linked Servers in the Object Explorer Pane. You can
now issue distributed queries and access MySQL databases through SQL Server.
© 2019 Devart
82 ODBC Driver for MySQL
In the appeared Provider Options window, clear the Allow inprocess checkbox:
© 2019 Devart
Using in Third-Party Tools 83
Make sure to select Microsoft OLE DB Provider for ODBC Drivers and specify the
following parameters:
The MySQL tables are already available to be fetched. To query the linked server, click New
Query in the toolbar:
© 2019 Devart
84 ODBC Driver for MySQL
Enter your SQL query in the editor window and click Execute to run the query:
As a result, you can see the contents of the selected table retrieved directly from the MySQL
account you are connected to.
Attention
© 2019 Devart
Using in Third-Party Tools 85
If the Linked Server was created with the Allow inprocess option enabled, then you should
delete this Linked Server and create it again with the Allow inprocess option disabled.
See also
Troubleshooting SSMS
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
4.3.2 Troubleshooting in SSMS
When creating a linked server in SSMS, most errors happen due to security issues with
DCOM class MSDAINITIALIZE. We need to alter the DCOM Class MSDAINITIALIZE security
settings to make it work.
Following are the steps:
1. Open Component Services (Start>Run>DCOMCNFG)
2. Expand Component Services>Computers>My Computer>DCOM Config
3. From the list of DCOM components on the right side, select MSDAINITIALIZE and go to its
properties:
© 2019 Devart
86 ODBC Driver for MySQL
4. Go to the Security Tab, Choose ‘Customize’ and click on the ‘Edit’ Button:
© 2019 Devart
Using in Third-Party Tools 87
5. Add the Domain User who is accessing the linked server and ‘Allow’ all the permissions
available (Local Launch, Remote Launch, Local Activation, Remote Activation). If you are
connecting to SQL server using SQL account, you need to provide this permission to the
account under which the SQL service is running.
6. Do this for all the 3 sections in the above screenshot.
© 2019 Devart
88 ODBC Driver for MySQL
© 2019 Devart
Using in Third-Party Tools 89
See also
Error message when you try to create an instance of an OLE DB provider in SQL Server:
"Cannot create an instance of OLE DB provider"
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
© 2019 Devart
90 ODBC Driver for MySQL
sources using the respective driver. You can access MySQL data from Open Office Base or
LibreOffice Base — desktop database management systems. Note that the Windows version
of OpenOffice is 32-bit, and you may get the error “The specified DSN contains an
architecture mismatch between the Driver and Application” when trying to access a data
source through a 64-bit ODBC driver. To get rid of the error message, set up the 32-bit
version of the driver.
To connect to an ODBC data source from OpenOffice or LibreOffice using our driver for
MySQL, perform the steps below:
1. Start OpenOffice or LibreOffice, click Database to open the Database Wizard.
Alternatively, you can launch the Database Wizard from OpenOffice or LibreOffice Calc,
Writer or any other tool by choosing File > New > Database.
© 2019 Devart
Using in Third-Party Tools 91
2. In the Database Wizard dialog box, click Connect to an existing database, select
ODBC from the drop-down list, and click Next.
© 2019 Devart
92 ODBC Driver for MySQL
3. Specify the name of the data source you want to connect to. You can either type the name
of your data source into the field, e.g. ODBC Driver for MySQL, or you can click Browse,
double-click the data source you need, and then click Next.
© 2019 Devart
Using in Third-Party Tools 93
4. If your database requires a user name, type it into the User name field. If you are
connecting to a password protected database, check the Password required field.
Alternatively, you can specify these parameters in the data source settings of your ODBC
Driver for MySQL and leave these fields empty in Database Wizard.
© 2019 Devart
94 ODBC Driver for MySQL
To test the connection to your data source, click Test Connection, input your credentials
and click OK.
© 2019 Devart
Using in Third-Party Tools 95
If you have entered valid credentials, you will see a success message. Click Next to proceed
to the final step.
5. You can keep the default selection in this dialog box and click Finish.
© 2019 Devart
96 ODBC Driver for MySQL
You will be prompted to give a name to your new database and select the directory where you
want to store it.
© 2019 Devart
Using in Third-Party Tools 97
6. When the database opens, you will see the list of tables from your data source diplayed in
OpenOffice or LibreOffice Base workspace. To view the data from a specific table, double-
click the table name.
© 2019 Devart
98 ODBC Driver for MySQL
7. To create an SQL query, click Queries in the Database pane, then click Create Query in
SQL View…
Enter your query in the query text box and click Run Query (F5). The date will be fetched
from the database and displayed in Open Office or LibreOffice, respectively.
© 2019 Devart
Using in Third-Party Tools 99
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
PHP-based projects usually require a data storage, whether a traditional database or a cloud-
based database. You can establish a connection to them using ODBC interface. With our
ODBC drivers, you can access various data sources and retrieve tables and fields from a
database.
Below is a sample PHP script for accessing MySQL via ODBC. The script connects to
MySQL database and fetchs all records from a table:
The odbc_connect() function is used to connect to an ODBC data source. Note that the
function takes three mandatory parameters: the data source name, username and password.
© 2019 Devart
100 ODBC Driver for MySQL
The odbc_fetch_row() function is used to return records from the result set. While
odbc_fetch_row() returns rows, the odbc_result_set() function prints a set of result in HTML
table. After all rows from the result set have been printed, the odbc_close() function closes
the connection.
while (odbc_fetch_row($RecordSet)) {
$result = odbc_result_all($RecordSet, "border=1");
}
odbc_close($ODBCConnection);
?>
You can modify this script by specifying general settings for each Devart ODBC driver to use
any of them with your PHP projects.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
If you don't have Python installed on your machine, go to the Python official website, download
© 2019 Devart
Using in Third-Party Tools 101
the appropriate installer and run it. You will also need to install the pyodbc module — the
easiest way to do that is by using the pip install pyodbc command in the Python interactive
mode. Next, you need to download the ODBC Driver for MySQL. To use the ODBC driver as
a translation layer between the application and the database, you need to configure it by
following the installation instructions.
Step 1: Connect
import pyodbc
cnxn = pyodbc.connect('DRIVER={Devart ODBC Driver for MySQL};User ID=myuser
Here's a simple example of how to execute an insert statement to test the connection to the
database. The script inserts a new record to the EMP table.
cursor = cnxn.cursor()
cursor.execute("INSERT INTO EMP (EMPNO, ENAME, JOB, MGR) VALUES (535, 'Scot
Step 3: Execute query
The cursor.execute() function retrieves rows from the select query on a dataset. The
cursor.fetchone() function iterates over the result set returned by cursor.execute() while the
print() function prints out all records from the table to the console.
cursor = cnxn.cursor()
cursor.execute("SELECT * FROM EMP")
row = cursor.fetchone()
while row:
print (row)
row = cursor.fetchone()
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
© 2019 Devart
102 ODBC Driver for MySQL
QlikView supports the ODBC connectivity interface for communication with external data
sources. An ODBC data source must be configured for the database you want to access.
You can create an ODBC connection using a DSN during the ODBC driver installation or
later.
To connect to an ODBC data source from QlikView using our driver for MySQL, perform the
steps below:
1. Open the QlikView client application and click File > New. Close the Getting Started
wizard and open File > Edit Script (CTRL+E).
© 2019 Devart
Using in Third-Party Tools 103
2. In the Data tab, choose ODBC from the Database drop-down and click Connect. Select
the Data Source you created earlier, type in the User ID and Password if your database is
password-protected. You can test the connection by choosing Test Connection. The
Connection Test succeeded message should appear. Click OK to connect to your data
source.
© 2019 Devart
104 ODBC Driver for MySQL
3. To retrieve the data from your data source, you can enter an SQL query and press F5. You
will be suggested to choose fields to be displayed.
© 2019 Devart
Using in Third-Party Tools 105
4. Alternatively, you can click Select, and QlikView will show you the database structure
window where you can compose a SELECT statement for the data to be fetched. You can
choose a different database from the database drop-down list. Select the necessary tables
and fields. You can retrieve date from multiple tables and fields by selecting them and
clicking Add. When you are ready with your SELECT statement, click OK. You will get
back to the main script editor with your SQL statement. Press F5 to execute the script and
select the fields to be displayed in QlikView.
5. Once the data has been fetched, you can choose a table layout to present the data in a
© 2019 Devart
106 ODBC Driver for MySQL
table. Choose Layout > New Sheet Object > Table Box. Select the fields to be added to
the tablebox and click OK.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
SQL Server Integration Services (SSIS) is a component of SQL Server that is designed to
perform various data migration tasks. When using Devart ODBC Driver for MySQL as a
translation layer between the data source and SSIS, the driver and SSIS communicate via
Microsoft ODBC version 3.x.
© 2019 Devart
Using in Third-Party Tools 107
Note that when you extract data from an ODBC data source using the SQLExecDirect
function, an issue may occur: SSIS expects the 2.x version of ODBC behavior, while the
ODBC driver continues to fetch data from a data source via ODBC version 3.x.
To prevent any issues when using SQLExecDirect, you should force the 2.x version of ODBC
behavior in the DSN settings: open the Advanced Settings tab and select Ver 2.x from the
ODBC Behavior dropdown.
© 2015-2019
Devart. All Rights Request Support ODBC Forum Provide Feedback
Reserved.
© 2019 Devart