MySqlConnectionStringBuilder class
MySqlConnectionStringBuilder allows you to construct a MySQL connection string by setting properties on the builder then reading the ConnectionString property.
public sealed class MySqlConnectionStringBuilder : DbConnectionStringBuilder
Public Members
| name | description |
|---|---|
| MySqlConnectionStringBuilder() | Initializes a new MySqlConnectionStringBuilder. |
| MySqlConnectionStringBuilder(…) | Initializes a new MySqlConnectionStringBuilder with properties set from the specified connection string. |
| AllowLoadLocalInfile { get; set; } | Allows the LOAD DATA LOCAL command to request files from the client. |
| AllowPublicKeyRetrieval { get; set; } | Allows the client to automatically request the RSA public key from the server. |
| AllowUserVariables { get; set; } | Allows user-defined variables (prefixed with @) to be used in SQL statements. |
| AllowZeroDateTime { get; set; } | Returns DATETIME fields as MySqlDateTime objects instead of DateTime objects. |
| ApplicationName { get; set; } | Sets the program_name connection attribute passed to MySQL Server. |
| AutoEnlist { get; set; } | Automatically enlists this connection in any active TransactionScope. |
| CancellationTimeout { get; set; } | The length of time (in seconds) to wait for a query to be canceled when CommandTimeout expires, or zero for no timeout. |
| CertificateFile { get; set; } | The path to a certificate file in PKCS #12 (.pfx) format containing a bundled Certificate and Private Key used for mutual authentication. |
| CertificatePassword { get; set; } | The password for the certificate specified using the CertificateFile option. Not required if the certificate file is not password protected. |
| CertificateStoreLocation { get; set; } | Uses a certificate from the specified Certificate Store on the machine. The default value of None means the certificate store is not used; a value of CurrentUser or LocalMachine uses the specified store. |
| CertificateThumbprint { get; set; } | Specifies which certificate should be used from the Certificate Store specified in CertificateStoreLocation. This option must be used to indicate which certificate in the store should be used for authentication. |
| CharacterSet { get; set; } | Supported for backwards compatibility; MySqlConnector always uses utf8mb4. |
| ConnectionIdleTimeout { get; set; } | The amount of time (in seconds) that a connection can remain idle in the pool. |
| ConnectionLifeTime { get; set; } | The maximum lifetime (in seconds) for any connection, or 0 for no lifetime limit. |
| ConnectionProtocol { get; set; } | The protocol to use to connect to the MySQL Server. |
| ConnectionReset { get; set; } | Whether connections are reset when being retrieved from the pool. |
| ConnectionTimeout { get; set; } | The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. The default value is 15. |
| ConvertZeroDateTime { get; set; } | Whether invalid DATETIME fields should be converted to MinValue. |
| Database { get; set; } | (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. |
| DateTimeKind { get; set; } | The DateTimeKind to use when deserializing DATETIME values. |
| DefaultCommandTimeout { get; set; } | The length of time (in seconds) each command can execute before the query is cancelled on the server, or zero to disable timeouts. |
| DnsCheckInterval { get; set; } | The number of seconds between checks for DNS changes, or 0 to disable periodic checks. |
| ForceSynchronous { get; set; } | Forces all async methods to execute synchronously. This can be useful for debugging. |
| GuidFormat { get; set; } | Determines which column type (if any) should be read as a Guid. |
| IgnoreCommandTransaction { get; set; } | Does not check the Transaction property for validity when executing a command. |
| IgnorePrepare { get; set; } | Ignores calls to Prepare and PrepareAsync. |
| InteractiveSession { get; set; } | Instructs the MySQL server that this is an interactive session. |
| override Item { get; set; } | Retrieves an option value by name. |
| Keepalive { get; set; } | TCP Keepalive idle time (in seconds), or 0 to use OS defaults. |
| override Keys { get; } | Returns an ICollection that contains the keys in the MySqlConnectionStringBuilder. |
| LoadBalance { get; set; } | Specifies how load is distributed across backend servers. |
| MaximumPoolSize { get; set; } | The maximum number of connections allowed in the pool. |
| MinimumPoolSize { get; set; } | The minimum number of connections to leave in the pool if ConnectionIdleTimeout is reached. |
| NoBackslashEscapes { get; set; } | Doesn’t escape backslashes in string parameters. For use with the NO_BACKSLASH_ESCAPES MySQL server mode. |
| OldGuids { get; set; } | Use the GuidFormat property instead. |
| Password { get; set; } | The password for the MySQL user. |
| PersistSecurityInfo { get; set; } | If true, preserves security-sensitive information in the connection string retrieved from any open MySqlConnection. |
| Pipelining { get; set; } | Enables query pipelining. |
| PipeName { get; set; } | The name of the Windows named pipe to use to connect to the server. You must also set ConnectionProtocol to NamedPipe to used named pipes. |
| Pooling { get; set; } | Enables connection pooling. |
| Port { get; set; } | The TCP port on which MySQL Server is listening for connections. |
| Server { get; set; } | The host name or network address of the MySQL Server to which to connect. Multiple hosts can be specified in a comma-delimited list. |
| ServerRedirectionMode { get; set; } | Whether to use server redirection. |
| ServerRsaPublicKeyFile { get; set; } | The path to a file containing the server’s RSA public key. |
| ServerSPN { get; set; } | The server’s Service Principal Name (for auth_gssapi_client authentication). |
| SslCa { get; set; } | The path to a CA certificate file in a PEM Encoded (.pem) format. This should be used with a value for the SslMode property of VerifyCA or VerifyFull to enable verification of a CA certificate that is not trusted by the operating system’s certificate store. |
| SslCert { get; set; } | The path to the client’s SSL certificate file in PEM format. SslKey must also be specified, and CertificateFile should not be. |
| SslKey { get; set; } | The path to the client’s SSL private key in PEM format. SslCert must also be specified, and CertificateFile should not be. |
| SslMode { get; set; } | Whether to use SSL/TLS when connecting to the MySQL server. |
| TlsCipherSuites { get; set; } | The TLS cipher suites which 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. |
| TlsVersion { get; set; } | The TLS versions which may be used during TLS negotiation, or empty to use OS defaults. |
| TreatTinyAsBoolean { get; set; } | Returns TINYINT(1) fields as Boolean values. |
| UseAffectedRows { get; set; } | Report changed rows instead of found rows. |
| UseCompression { get; set; } | Compress packets sent to and from the server. |
| UserID { get; set; } | The MySQL user ID. |
| UseXaTransactions { get; set; } | Use XA transactions to implement TransactionScope distributed transactions. |
| override ContainsKey(…) | Whether this MySqlConnectionStringBuilder contains a set option with the specified name. |
| override Remove(…) | Removes the option with the specified name. |
Protected Members
| name | description |
|---|---|
| override GetProperties(…) | Fills in propertyDescriptors with information about the available properties on this object. |
Remarks
See Connection String Options for more documentation on the options.
See Also
- namespace MySqlConnector
- assembly MySqlConnector