ODBC Driver for MySQL

Connection String Options - ODBC Driver for MySQL

MySQL ODBC Connection String Options

The following table lists the connection string options for MySQL.

Option Description

Server

Serves to supply the server name for login.

Port

Used to specify the port number for the connection. 3306 by default.

User ID

Used to supply a user name for login.

Password

Used to supply a password for login.

Database

Used to set the name of the database

Charset

Used to set the character set that ODBC driver for MySQL uses to read and write character data.

UseUnicode

Informs server that all data between client and server sides will be passed in Utf8 coding. Setting this option converts all fields of the String type into WideString that allows to work correctly with symbols of almost all languages simultaneously. On the other hand, it causes a delay in working. If the Use Unicode property is enabled, the Charset property will be ignored. The default value is False.

Compress

Used to apply compression on transferring data. Setting this property to True is quite effective on transferring big volumes of data through slow connection. Pay attention that each row is compressed separately. Be careful when setting this option as in some cases it may decrease fetch speed instead of increasing. The default value is False.

Interactive

Permit interactive_timeout seconds (instead of wait_timeout seconds) of inactivity before closing the connection. The client's session wait_timeout variable is set to the value of the session interactive_timeout variable. The default value is false.

Advanced Settings

Option Description

Allow NULL strings

To retrieve metadata, not all parameters according to MSDN can accept a null value. If NULL, the driver should return an error. But some 3rd-party tools pass NULL to the parameters. These options should be enabled for compatibility with such tools.

Empty strings as NULL

Connection Timeout

The time (in seconds) to wait for a connection to open before terminating an attempt. The default value is 15.

IP Version The Internet Protocol Version.
ivIPv4
The default value. Internet Protocol Version 4 (IPv4) is used.
ivIPv6
Internet Protocol Version 6 (IPv6) is used.
ivIPBoth
Either Internet Protocol Version 6 (IPv6) or Version 4 (IPv4) is used.
Note: When the property is set to ivIPBoth, a connection attempt is made via IPv6 if it is enabled in the operating system. If the connection attempt fails, a new connection attempt is made via IPv4.

ODBC Behavior

Used to set the behavior corresponding to the ODBC specification 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. 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.

Query Timeout

Used to specify the number of seconds that the execution of an SQL query can take before it is terminated and an exception is raised. If the value is 0, no timeout will happen. The default value is 0.

RegionalNumberSettings

Enables the use of local regional settings when converting numbers to strings.

RegionalDateTimeSettings

Enables the use of local regional settings when converting dates and times to strings.

String Types

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 SQL_LONGVARCHAR.
  • Unicode - all string types will be returned as SQL_WCHAR, SQL_WVARCHAR and SQL_WLONGVARCHAR.

The option value should be changed if any third-party tool supports only Ansi string types or Unicode ones.

Mapping TimeStamp as VarChar Used to convert TIMESTAMP values to VARCHAR values. The default value is False.

MySQL ODBC Connection String sample

DRIVER={Devart ODBC Driver for MySQL};User ID=root;Password=root;Data Source=localhost;Database=test

See also:

© 2015-2022 Devart. All Rights Reserved. Request Support ODBC Forum Provide Feedback