Skip to content

Commit d84be13

Browse files
committed
Add [Category] and [DisplayName] to all connection options. Fixes #1030
This aligns the PropertyDescriptor.DisplayName with the DbConnectionStringBuilder key for getting/setting the property. Fixes ICustomTypeDescriptor-related issues with MySqlConnectionStringBuilder. Rearranged connection string option documentation to put the DisplayName first in the list of synonyms. This does introduce breaking changes for anyone who was depending on the exact format of option keys in the rendered connection string. (All previous options are still accepted.)
1 parent 51f4dc0 commit d84be13

File tree

5 files changed

+369
-73
lines changed

5 files changed

+369
-73
lines changed

docs/content/connection-options.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ These are the basic options that need to be defined to connect to a MySQL databa
3232
<th style="width: 70%">Description</th>
3333
</thead>
3434
<tr id="Host">
35-
<td><a name="Server"></a>Host, Server, Data Source, DataSource, Address, Addr, Network Address</td>
35+
<td><a name="Server"></a>Server, Host, Data Source, DataSource, Address, Addr, Network Address</td>
3636
<td>localhost</td>
3737
<td>The host name or network address of the MySQL Server to which to connect. Multiple hosts can be specified in a comma-delimited list.<br>On Unix-like systems, this can be a fully qualified path to a MySQL socket file, which will cause a Unix socket to be used instead of a TCP/IP socket. Only a single socket name can be specified.</td>
3838
</tr>
@@ -42,7 +42,7 @@ These are the basic options that need to be defined to connect to a MySQL databa
4242
<td>The TCP port on which MySQL Server is listening for connections.</td>
4343
</tr>
4444
<tr id="UserId">
45-
<td>User Id, UserID, Username, Uid, User name, User</td>
45+
<td>User ID, UserID, Username, Uid, User name, User</td>
4646
<td></td>
4747
<td>The MySQL user ID.</td>
4848
</tr>
@@ -56,8 +56,8 @@ These are the basic options that need to be defined to connect to a MySQL databa
5656
<td></td>
5757
<td>(Optional) The case-sensitive name of the initial database to use. This may be required if the MySQL user account only has access rights to particular databases on the server.</td>
5858
</tr>
59-
<tr id="Protocol">
60-
<td>Protocol, ConnectionProtocol, Connection Protocol</td>
59+
<tr id="ConnectionProtocol">
60+
<td>Connection Protocol, ConnectionProtocol, Protocol</td>
6161
<td>Socket</td>
6262
<td>How to connect to the MySQL Server. This option has the following values:
6363
<ul>
@@ -68,7 +68,7 @@ These are the basic options that need to be defined to connect to a MySQL databa
6868
</td>
6969
</tr>
7070
<tr id="PipeName">
71-
<td>Pipe, PipeName, Pipe Name</td>
71+
<td>Pipe Name, Pipe, PipeName</td>
7272
<td>MYSQL</td>
7373
<td>The name of the Windows named pipe to use to connect to the server. You must also set <code>ConnectionProtocol=pipe</code> to used named pipes.</td>
7474
</tr>
@@ -109,17 +109,17 @@ These are the options that need to be used in order to configure a connection to
109109
<td>Specifies the password for the certificate specified using the <code>CertificateFile</code> option. Not required if the certificate file is not password protected.</td>
110110
</tr>
111111
<tr id="SslCert">
112-
<td>SslCert, Ssl-Cert</td>
112+
<td>SSL Cert, SslCert, Ssl-Cert</td>
113113
<td></td>
114114
<td>Specifies the path to the client’s SSL certificate file in PEM format. <code>SslKey</code> must also be specified, and <code>CertificateFile</code> should not be. This option is not supported on <code>netstandard2.0</code>.</td>
115115
</tr>
116116
<tr id="SslKey">
117-
<td>SslKey, Ssl-Key</td>
117+
<td>SSL Key, SslKey, Ssl-Key</td>
118118
<td></td>
119119
<td>Specifies the path to the client’s SSL private key in PEM format. <code>SslCert</code> must also be specified, and <code>CertificateFile</code> should not be.</td>
120120
</tr>
121121
<tr id="SslCa">
122-
<td>CA Certificate File, CACertificateFile, SslCa, Ssl-Ca</td>
122+
<td>SSL CA, CA Certificate File, CACertificateFile, SslCa, Ssl-Ca</td>
123123
<td></td>
124124
<td>This option specifies the path to a CA certificate file in a PEM Encoded (.pem) format. This should be used with <code>SslMode=VerifyCA</code> or <code>SslMode=VerifyFull</code> to enable verification of a CA certificate that is not trusted by the Operating System’s certificate store.</td>
125125
</tr>
@@ -134,12 +134,12 @@ These are the options that need to be used in order to configure a connection to
134134
<td>Specifies which certificate should be used from the Certificate Store specified in the setting above. This option must be used to indicate which certificate in the store should be used for authentication.</td>
135135
</tr>
136136
<tr id="TlsCipherSuites">
137-
<td>Tls Cipher Suites,TlsCipherSuites</td>
137+
<td>TLS Cipher Suites,TlsCipherSuites</td>
138138
<td></td>
139139
<td>Specifies which TLS cipher suites may be used during TLS negotiation. The default value (the empty string) allows the OS to determine the TLS cipher suites to use; this is the recommended setting. Otherwise, specify a comma-delimited list of <a href="https://docs.microsoft.com/en-us/dotnet/api/system.net.security.tlsciphersuite"><code>TlsCipherSuite</code> enum values</a> to allow just those cipher suites. (This option is only supported on Linux when using .NET Core 3.1 or .NET 5.0 or later.)</td>
140140
</tr>
141141
<tr id="TlsVersion">
142-
<td>Tls Version, TlsVersion, Tls-Version</td>
142+
<td>TLS Version, TlsVersion, Tls-Version</td>
143143
<td></td>
144144
<td>Specifies which TLS versions may be used during TLS negotiation. The default value of <code>null</code> allows the OS to determine the TLS version to use (see <a href="https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls" title="Transport Layer Security (TLS) best practices with the .NET Framework">documentation</a>); this is the recommended setting. Otherwise, to restrict the versions that can be used, specify a comma-delimited list of versions taken from the following: <code>TLS 1.0</code>, <code>TLS 1.1.</code>, <code>TLS 1.2</code>, <code>TLS 1.3</code>. (This option allows each version to be specified in a few different formats: <code>Tls12</code>, <code> Tlsv1.2</code>, <code>TLS 1.2</code>, <code>Tls v1.2</code>; they are treated equivalently.)</td>
145145
</tr>
@@ -194,12 +194,12 @@ Connection pooling is enabled by default. These options are used to configure it
194194
<td><code>true</code></td>
195195
<td>If <code>true</code>, the connection state is not reset until the connection is retrieved from the pool. The experimental value of <code>false</code> resets connections in the background after they’re closed which can make opening a connection faster, and releases server resources sooner; however, there are reports of connection pool exhaustion when using this value.</td>
196196
</tr>
197-
<tr id="MaxPoolSize">
197+
<tr id="MaximumPoolSize">
198198
<td>Maximum Pool Size, Max Pool Size, MaximumPoolsize, maxpoolsize</td>
199199
<td>100</td>
200200
<td>The maximum number of connections allowed in the pool.</td>
201201
</tr>
202-
<tr id="MinPoolSize">
202+
<tr id="MinimumPoolSize">
203203
<td>Minimum Pool Size, Min Pool Size, MinimumPoolSize, minpoolsize</td>
204204
<td>0</td>
205205
<td>The minimum number of connections to leave in the pool if ConnectionIdleTimeout is reached.</td>
@@ -232,82 +232,82 @@ These are the other options that MySqlConnector supports. They are set to sensib
232232
<th style="width: 70%">Description</th>
233233
</thead>
234234
<tr id="AllowLoadLocalInfile">
235-
<td>AllowLoadLocalInfile, Allow Load Local Infile</td>
235+
<td>Allow Load Local Infile, AllowLoadLocalInfile</td>
236236
<td>false</td>
237237
<td>Allows the <code>LOAD DATA LOCAL</code> command to request files from the client. This is disabled by
238238
default as a <a href="/troubleshooting/load-data-local-infile/" title="Using Load Data Local Infile">security precaution</a>.
239239
In order to use <code>MySqlBulkLoader</code> and set its <code>Local</code> property to <code>true</code>, you
240240
must set this option to <code>True</code> in your connection string.</td>
241241
</tr>
242-
<tr id="AllowublicKeyRetrieval">
243-
<td>AllowPublicKeyRetrieval, Allow Public Key Retrieval</td>
242+
<tr id="AllowPublicKeyRetrieval">
243+
<td>Allow Public Key Retrieval, AllowPublicKeyRetrieval</td>
244244
<td>false</td>
245245
<td>If the user account uses <code>sha256_password</code> authentication, the password must be protected during transmission; TLS is the preferred mechanism for this,
246246
but if it is not available then RSA public key encryption will be used. To specify the server’s RSA public key, use the <code>ServerRSAPublicKeyFile</code> connection
247247
string setting, or set <code>AllowPublicKeyRetrieval=True</code> to allow the client to automatically request the public key from the server. Note that <code>AllowPublicKeyRetrieval=True</code>
248248
could allow a malicious proxy to perform a MITM attack to get the plaintext password, so it is <code>False</code> by default and must be explicitly enabled.</td>
249249
</tr>
250250
<tr id="AllowUserVariables">
251-
<td>AllowUserVariables, Allow User Variables</td>
251+
<td>Allow User Variables, AllowUserVariables</td>
252252
<td>false</td>
253253
<td>Allows user-defined variables (prefixed with <code>@</code>) to be used in SQL statements. The default value (<code>false</code>)
254254
only allows <code>@</code>-prefixed names to refer to command parameters.</td>
255255
</tr>
256256
<tr id="AllowZeroDateTime">
257-
<td>AllowZeroDateTime, Allow Zero DateTime</td>
257+
<td>Allow Zero DateTime, AllowZeroDateTime</td>
258258
<td>false</td>
259259
<td>If set to <c>true</c> all <code>DATE</code>, <code>DATETIME</code> and <code>TIMESTAMP</code> columns are returned as <code>MySqlDateTime</code> objects instead of <code>DateTime</code>.
260260
This allows the special “zero” date value <code>0000-00-00</code> to be retrieved from the database. If <code>false</code> (the default)
261261
date columns are returned as <code>DateTime</code> values, and an exception is thrown for unrepresentable dates.</td>
262262
</tr>
263263
<tr id="ApplicationName">
264-
<td>ApplicationName, Application Name</td>
264+
<td>Application Name, ApplicationName</td>
265265
<td>null</td>
266266
<td>Sets the <c>program_name</c> connection attribute passed to MySQL Server. This value may be displayed by diagnostic tools,
267267
e.g., as the “Program” column in “Client Connections” in <a href="https://www.mysql.com/products/workbench/">MySQL Workbench</a>.</td>
268268
</tr>
269269
<tr id="AutoEnlist">
270-
<td>AutoEnlist, Auto Enlist</td>
270+
<td>Auto Enlist, AutoEnlist</td>
271271
<td>true</td>
272272
<td>If <code>true</code> (default), <code>MySqlConnection</code> will detect if there is an active <code>TransactionScope</code> when it's opened and automatically enlist in it. If <code>false</code>, connections must be manually enlisted by calling <code>EnlistTransaction</code>.</td>
273273
</tr>
274274
<tr id="CancellationTimeout">
275-
<td>CancellationTimeout, Cancellation Timeout</td>
275+
<td>Cancellation Timeout, CancellationTimeout</td>
276276
<td>2</td>
277277
<td>The length of time (in seconds) to wait for a query to be canceled when <code>MySqlCommand.CommandTimeout</code> expires, or zero for no timeout. If a response isn’t received from the server in this
278278
time, the local socket will be closed and a <code>MySqlException</code> will be thrown.</td>
279279
</tr>
280-
<tr id="CharSet">
281-
<td>CharSet, Character Set, CharacterSet</td>
280+
<tr id="CharacterSet">
281+
<td>Character Set, CharSet, CharacterSet</td>
282282
<td>utf8mb4</td>
283283
<td>MySqlConnector always uses <code>utf8mb4</code> to send and receive strings from MySQL Server. This option may be specified (for backwards compatibility) but it will be ignored.</td>
284284
</tr>
285-
<tr id="Compress">
286-
<td>Compress, Use Compression, UseCompression</td>
285+
<tr id="UseCompression">
286+
<td>Use Compression, Compress, UseCompression</td>
287287
<td>false</td>
288288
<td>If true (and if the server supports compression), compresses packets sent between client and server. This option is unlikely to be useful in
289289
practice unless there is a high-latency or low-bandwidth network link between the application and the database server. You should measure
290290
performance with and without this option to determine if it’s beneficial in your environment.</td>
291291
</tr>
292292
<tr id="ConnectionTimeout">
293-
<td>Connect Timeout, Connection Timeout, ConnectionTimeout</td>
293+
<td>Connection Timeout, Connect Timeout, ConnectionTimeout</td>
294294
<td>15</td>
295295
<td>The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.</td>
296296
</tr>
297297
<tr id="ConvertZeroDateTime">
298-
<td>Convert Zero Datetime, ConvertZeroDateTime</td>
298+
<td>Convert Zero DateTime, ConvertZeroDateTime</td>
299299
<td>false</td>
300300
<td>True to have <code>MySqlDataReader.GetValue()</code> and <code>MySqlDataReader.GetDateTime()</code> return <code>DateTime.MinValue</code> for date or datetime columns that have disallowed values.</td>
301301
</tr>
302302
<tr id="DateTimeKind">
303-
<td>DateTimeKind</td>
303+
<td>DateTime Kind, DateTimeKind</td>
304304
<td>Unspecified</td>
305305
<td>The <code>DateTimeKind</code> used when <code>MySqlDataReader</code> returns a <code>DateTime</code>. If set to <code>Utc</code> or <code>Local</code>,
306306
a <code>MySqlException</code> will be thrown if a <code>DateTime</code> command parameter has a <code>Kind</code> of <code>Local</code> or <code>Utc</code>,
307307
respectively.</td>
308308
</tr>
309309
<tr id="GuidFormat">
310-
<td>GuidFormat</td>
310+
<td>GUID Format, GuidFormat</td>
311311
<td>Default</td>
312312
<td><p>Determines which column type (if any) should be read as a <code>System.Guid</code>.
313313
The options include:</p>
@@ -337,19 +337,19 @@ These are the other options that MySqlConnector supports. They are set to sensib
337337
for more explanation of how this is determined.</td>
338338
</tr>
339339
<tr id="IgnoreCommandTransaction">
340-
<td>IgnoreCommandTransaction, Ignore Command Transaction</td>
340+
<td>Ignore Command Transaction, IgnoreCommandTransaction</td>
341341
<td>false</td>
342342
<td>If <code>true</code>, the value of <code>MySqlCommand.Transaction</code> is ignored when commands are executed.
343343
This matches the Connector/NET behaviour and can make porting code easier. For more information, see <a href="troubleshooting/transaction-usage/">Transaction Usage</a>.</td>
344344
</tr>
345345
<tr id="IgnorePrepare">
346-
<td>IgnorePrepare, Ignore Prepare</td>
346+
<td>Ignore Prepare, IgnorePrepare</td>
347347
<td>false</td>
348348
<td>If <code>true</code>, calls to <code>MySqlCommand.Prepare(Async)</code> are ignored (and will be no-ops).
349349
This option is provided for backwards compatibility with MySQL Connector/NET (before 8.0.23) and should not be used.</td>
350350
</tr>
351351
<tr id="InteractiveSession">
352-
<td>Interactive, Interactive Session, InteractiveSession</td>
352+
<td>Interactive Session, Interactive, InteractiveSession</td>
353353
<td>false</td>
354354
<td>If <code>true</code>, the session <code>wait_timeout</code> variable is initialized from the global <code>interactive_timeout<code> value instead of the global <code>wait_timeout</code> value.</td>
355355
</tr>
@@ -392,7 +392,7 @@ These are the other options that MySqlConnector supports. They are set to sensib
392392
<td>When set to <code>false</code> or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection string if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values, including the password. Recognized values are true, false, yes, and no.</td>
393393
</tr>
394394
<tr id="ServerRedirectionMode">
395-
<td>ServerRedirectionMode, Server Redirection Mode</td>
395+
<td>Server Redirection Mode, ServerRedirectionMode</td>
396396
<td>Disabled</td>
397397
<td><p>Whether to use server redirection. The options include:</p>
398398
<dl>
@@ -408,12 +408,12 @@ These are the other options that MySqlConnector supports. They are set to sensib
408408
</td>
409409
</tr>
410410
<tr id="ServerRsaPublicKeyFile">
411-
<td>ServerRsaPublicKeyFile, Server RSA Public Key File</td>
411+
<td>Server RSA Public Key File, ServerRsaPublicKeyFile</td>
412412
<td></td>
413413
<td>For <code>sha256_password</code> authentication. See comments under <code>AllowPublicKeyRetrieval</code>.</td>
414414
</tr>
415415
<tr id="ServerSPN">
416-
<td>ServerSPN, Server SPN</td>
416+
<td>Server SPN, ServerSPN</td>
417417
<td></td>
418418
<td>For MariaDB <a href="https://mariadb.com/kb/en/library/authentication-plugin-gssapi/"><code>auth_gssapi_client</code></a> authentication. Specifies the server’s Service Principal Name (to verify that authentication is occurring with the correct server).</td>
419419
</tr>

docs/content/tutorials/migrating-from-connector-net.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,4 @@ The following bugs in Connector/NET are fixed by switching to MySqlConnector. (~
285285
* [#103390](https://bugs.mysql.com/bug.php?id=103390): Can't query `CHAR(36)` column if `MySqlCommand` is prepared
286286
* [#103801](https://bugs.mysql.com/bug.php?id=103801): `TimeSpan` parameters lose microseconds with prepared statement
287287
* [#103819](https://bugs.mysql.com/bug.php?id=103819): Can't use `StringBuilder` containing non-BMP characters as `MySqlParameter.Value`
288+
* [#104910](https://bugs.mysql.com/bug.php?id=104910): `MySqlConnectionStringBuilder.TryGetValue` always returns `false`

0 commit comments

Comments
 (0)