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 (on Windows) | The username used to connect to MySQL. |
server |
localhost |
The hostname 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 . |
stmt |
A statement to execute when connecting to MySQL. | |
password |
The password for the user account on
server . |
|
socket |
The Unix socket file or Windows named pipe to connect to if
server is
localhost . |
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 | Windows Checkbox | Description |
1 | Don't Optimized Column Width | The client can't handle that Connector/ODBC returns the real width of a column. |
2 | Return Matching Rows | The client can't 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 | Trace Driver Calls To myodbc.log | Make a debug log in C:\myodbc.log on Windows, or
/tmp/myodbc.log on Unix variants. |
8 | Allow Big Results | Don't set any packet limit for results and parameters. |
16 | Don't Prompt Upon Connect | Don't prompt for questions even if driver would like to prompt. |
32 | Enable Dynamic Cursor | Enable or disable the dynamic cursor support. (Not allowed in Connector/ODBC 2.50.) |
64 | Ignore # in Table Name | Ignore use of database name in
db_name.tbl_name.col_name . |
128 | User Manager Cursors | Force use of ODBC manager cursors (experimental). |
256 | Don't Use Set Locale | Disable the use of extended fetch (experimental). |
512 | Pad Char To Full Length | Pad CHAR columns to full column length. |
1024 | Return Table Names for SQLDescribeCol |
SQLDescribeCol() returns fully qualified column
names. |
2048 | Use Compressed Protocol | Use the compressed client/server protocol. |
4096 | 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 | Force Use of Named Pipes | Connect with named pipes to a mysqld server running on NT. |
16384 | Change BIGINT Columns to Int | Change BIGINT columns to INT
columns (some applications can't handle
BIGINT ). |
32768 | No Catalog (exp) | Return 'user' as Table_qualifier and
Table_owner from
SQLTables (experimental). |
65536 | Read Options From my.cnf
|
Read parameters from the [client] and
[odbc] groups from
my.cnf . |
131072 | Safe | Add some extra safety checks (should not be needed but...). |
262144 | Disable transaction | Disable transactions. |
524288 | Save queries to myodbc.sql
|
Enable query logging to
c:\myodbc.sql (/tmp/myodbc.sql )
file. (Enabled only in debug mode.) |
1048576 | Don't 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 don't want the
driver to cache the entire result set. |
2097152 | 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 non-cache result
sets, then this option ensures the forward-only cursor
behavior. |
4194304 | 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 enabled in Connector/ODBC 3.5.13. |
8388608 | Flag Auto Is Null | When set, this option causes the connection to set the
SQL_AUTO_IS_NULL option to 1. This
disables the standard behavior, but may enable older
applications to correctly identify
AUTO_INCREMENT values. For more
information, see Capítulo 12, Funciones y operadores. This
option was enabled in Connector/ODBC 3.5.13. |
To select multiple options, add together their values. For
example, setting option
to 12 (4+8) gives you
debugging without packet limits.
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 |
Ésta es una traducción del manual de referencia de MySQL, que puede encontrarse en dev.mysql.com. El manual de referencia original de MySQL está escrito en inglés, y esta traducción no necesariamente está tan actualizada como la versión original. Para cualquier sugerencia sobre la traducción y para señalar errores de cualquier tipo, no dude en dirigirse a mysql-es@vespito.com.