You can specify the parameters in the following tables for
Connector/ODBC when configuring a DSN. Users on Windows can use
the Options and Advanced panels when configuring a DSN to set
these parameters; see the table for information on which options
relate to which fields and checkboxes. On Unix and Mac OS X, use
the parameter name and value as the keyword/value pair in the
DSN configuration. Alternatively, you can set these parameters
within the InConnectionString
argument in the
SQLDriverConnect()
call.
Parameter | Default Value | Comment |
---|---|---|
user |
ODBC | The user name used to connect to MySQL. |
uid |
ODBC | Synonymous with user . Added in 3.51.16. |
server |
localhost |
The host name of the MySQL server. |
database |
The default database. | |
option |
0 | Options that specify how Connector/ODBC should work. See below. |
port |
3306 | The TCP/IP port to use if server is not
localhost . |
initstmt |
Initial statement. A statement to execute when connecting to MySQL. In
version 3.51 the parameter is called
stmt . Note, the driver supports the
initial statement being executed only at the time of the
initial connection. |
|
password |
The password for the user account on
server . |
|
pwd |
Synonymous with password . Added in 3.51.16. |
|
socket |
The Unix socket file or Windows named pipe to connect to if
server is
localhost . |
|
sslca |
The path to a file with a list of trust SSL CAs. Added in 3.51.16. | |
sslcapath |
The path to a directory that contains trusted SSL CA certificates in PEM format. Added in 3.51.16. | |
sslcert |
The name of the SSL certificate file to use for establishing a secure connection. Added in 3.51.16. | |
sslcipher |
A list of allowable ciphers to use for SSL encryption. The cipher list
has the same format as the openssl
ciphers command Added in 3.51.16. |
|
sslkey |
The name of the SSL key file to use for establishing a secure connection. Added in 3.51.16. | |
charset |
The character set to use for the connection. Added in 3.51.17. | |
sslverify |
If set to 1, the SSL certificate will be verified when used with the MySQL connection. If not set, then the default behavior is to ignore SSL certificate verification. | |
readtimeout |
The timeout in seconds for attempts to read from the server. Each
attempt uses this timeout value and there are retries if
necessary, so the total effective timeout value is three
times the option value. You can set the value so that a
lost connection can be detected earlier than the TCP/IP
Close_Wait_Timeout value of 10
minutes. This option works only for TCP/IP connections,
and only for Windows prior to MySQL 5.1.12. Corresponds
to the MYSQL_OPT_READ_TIMEOUT option
of the MySQL Client Library. This option was added in
Connector/ODBC 3.51.27. |
|
writetimeout |
The timeout in seconds for attempts to write to the server. Each attempt
uses this timeout value and there are
net_retry_count retries if necessary,
so the total effective timeout value is
net_retry_count times the option
value. This option works only for TCP/IP connections,
and only for Windows prior to MySQL 5.1.12. Corresponds
to the MYSQL_OPT_WRITE_TIMEOUT option
of the MySQL Client Library. This option was added in
Connector/ODBC 3.51.27. |
The SSL configuration parameters can also be automatically
loaded from a my.ini
or
my.cnf
file.
The option
argument is used to tell
Connector/ODBC that the client isn't 100% ODBC compliant. On
Windows, you normally select options by toggling the checkboxes
in the connection screen, but you can also select them in the
option
argument. The following options are
listed in the order in which they appear in the Connector/ODBC
connect screen.
Value | Flagname | GUI Option | Description |
1 | FLAG_FIELD_LENGTH |
Do not Optimize Column Width | The client cannot handle that Connector/ODBC returns the real width of a column. This option was removed in 3.51.18. |
2 | FLAG_FOUND_ROWS |
Return Matching Rows | The client cannot handle that MySQL returns the true value of affected rows. If this flag is set, MySQL returns “found rows” instead. You must have MySQL 3.21.14 or newer to get this to work. |
4 | FLAG_DEBUG |
Trace Driver Calls To myodbc.log | Make a debug log in C:\myodbc.log on Windows, or
/tmp/myodbc.log on Unix variants.
This option was removed in Connector/ODBC 3.51.18. |
8 | FLAG_BIG_PACKETS |
Allow Big Results | Do not set any packet limit for results and bind parameters. Without this option, parameter binding will be truncated to 255 characters. |
16 | FLAG_NO_PROMPT |
Do not Prompt Upon Connect | Do not prompt for questions even if driver would like to prompt. |
32 | FLAG_DYNAMIC_CURSOR |
Enable Dynamic Cursor | Enable or disable the dynamic cursor support. |
64 | FLAG_NO_SCHEMA |
Ignore # in Table Name | Ignore use of database name in
db_name.tbl_name.col_name . |
128 | FLAG_NO_DEFAULT_CURSOR |
User Manager Cursors | Force use of ODBC manager cursors (experimental). |
256 | FLAG_NO_LOCALE |
Do not Use Set Locale | Disable the use of extended fetch (experimental). |
512 | FLAG_PAD_SPACE |
Pad Char To Full Length | Pad CHAR columns to full column length. |
1024 | FLAG_FULL_COLUMN_NAMES |
Return Table Names for SQLDescribeCol |
SQLDescribeCol() returns fully qualified column
names. |
2048 | FLAG_COMPRESSED_PROTO |
Use Compressed Protocol | Use the compressed client/server protocol. |
4096 | FLAG_IGNORE_SPACE |
Ignore Space After Function Names | Tell server to ignore space after function name and before
“( ” (needed by
PowerBuilder). This makes all function names keywords. |
8192 | FLAG_NAMED_PIPE |
Force Use of Named Pipes | Connect with named pipes to a mysqld server running on NT. |
16384 | FLAG_NO_BIGINT |
Change BIGINT Columns to Int | Change BIGINT columns to
INT columns (some
applications cannot handle
BIGINT ). |
32768 | FLAG_NO_CATALOG |
No Catalog | Forces results from the catalog functions, such as
SQLTables , to always return
NULL and the driver to report that
catalogs are not supported. |
65536 | FLAG_USE_MYCNF |
Read Options From my.cnf
|
Read parameters from the [client] and
[odbc] groups from
my.cnf . |
131072 | FLAG_SAFE |
Safe | Add some extra safety checks. |
262144 | FLAG_NO_TRANSACTIONS |
Disable transactions | Disable transactions. |
524288 | FLAG_LOG_QUERY |
Save queries to myodbc.sql
|
Enable query logging to
c:\myodbc.sql (/tmp/myodbc.sql )
file. (Enabled only in debug mode.) |
1048576 | FLAG_NO_CACHE |
Do not Cache Result (forward only cursors) | Do not cache the results locally in the driver, instead read from server
(mysql_use_result() ).
This works only for forward-only cursors. This option is
very important in dealing with large tables when you do
not want the driver to cache the entire result set. |
2097152 | FLAG_FORWARD_CURSOR |
Force Use Of Forward Only Cursors | Force the use of Forward-only cursor type. In case of
applications setting the default static/dynamic cursor
type, and one wants the driver to use noncache result
sets, then this option ensures the forward-only cursor
behavior. |
4194304 | FLAG_AUTO_RECONNECT |
Enable auto-reconnect. | Enables auto-reconnection functionality. You should not use this option with transactions, since a auto reconnection during a incomplete transaction may cause corruption. Note that an auto-reconnected connection will not inherit the same settings and environment as the original. This option was added in Connector/ODBC 3.51.13. |
8388608 | FLAG_AUTO_IS_NULL |
Flag Auto Is Null |
When
When Thus, omitting the flag disables the compatibility option and forces SQL standard behavior.
See |
16777216 | FLAG_ZERO_DATE_TO_MIN |
Flag Zero Date to Min | Translates zero dates (XXXX-00-00 ) into the minimum
date values supported by ODBC,
XXXX-01-01 . This resolves an issue
where some statements will not work because the date
returned and the minimum ODBC date value are
incompatible. This option was added in Connector/ODBC
3.51.17. |
33554432 | FLAG_MIN_DATE_TO_ZERO |
Flag Min Date to Zero | Translates the minimum ODBC date value (XXXX-01-01 )
to the zero date format supported by MySQL
(XXXX-00-00 ). This resolves an issue
where some statements will not work because the date
returned and the minimum ODBC date value are
incompatible. This option was added in Connector/ODBC
3.51.17. |
67108864 | FLAG_MULTI_STATEMENTS |
Allow multiple statements | Enables support for batched statements. This option was added in Connector/ODBC 3.51.18. |
134217728 | FLAG_COLUMN_SIZE_S32 |
Limit column size to 32-bit value | Limits the column size to a signed 32-bit value to prevent problems with larger column sizes in applications that do not support them. This option is automatically enabled when working with ADO applications. This option was added in Connector/ODBC 3.51.22. |
268435456 | FLAG_NO_BINARY_RESULT |
Always handle binary function results as character data | When set this option disables charset 63 for columns with an empty
org_table . This option was added in
Connector/ODBC 3.51.26. |
To select multiple options, add together their values. For
example, setting option
to 12 (4+8) gives you
debugging without packet limits.
From version of MySQL Connector/ODBC 5.1.6 onwards, it is possible to use
the flag name directly as a parameter in the connection
string, by using the flag name without the FLAG_ prefix. So,
in addition to using the options
parameter
with various flags set, it is now possible to use the flags
directly as parameters. For example,
FIELD_LENGTH
, FOUND_ROWS
and DEBUG
could all be used as parameters.
The following table shows some recommended
option
values for various configurations.
Configuration | Option Value |
Microsoft Access, Visual Basic | 3 |
Driver trace generation (Debug mode) | 4 |
Microsoft Access (with improved DELETE queries) | 35 |
Large tables with too many rows | 2049 |
Sybase PowerBuilder | 135168 |
Query log generation (Debug mode) | 524288 |
Generate driver trace as well as query log (Debug mode) | 524292 |
Large tables with no-cache results | 3145731 |
User Comments
Information is absent about where should be situated my.cnf file and what parameters is included to [odbc] part.
"Read parameters from the [client] and [odbc] groups from my.cnf."
Add your own comment.