Class MySqlConnectionStringBuilder
Aids in the creation of connection strings by exposing the connection options as properties. Contains connection options specific to the Classic MySQL protocol.
Inheritance
Implements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data.dll
Version: 9.1.0
Syntax
public sealed class MySqlConnectionStringBuilder : MySqlBaseConnectionStringBuilder, IDictionary, ICollection, IEnumerable, ICustomTypeDescriptor
Constructors
MySqlConnectionStringBuilder()
Main constructor.
Declaration
public MySqlConnectionStringBuilder()
MySqlConnectionStringBuilder(String, Boolean)
Constructor accepting a connection string.
Declaration
public MySqlConnectionStringBuilder(string connectionString, bool isAnalyzed = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
System.Boolean | isAnalyzed | Flag that indicates if the connection string has been analyzed. |
Properties
AllowBatch
Gets or sets a boolean value that indicates whether this connection will allow commands to send multiple SQL statements in one execution.
Declaration
public bool AllowBatch { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AllowLoadLocalInfile
Gets or sets a boolean value that indicates whether this connection will allow to load data local infile.
Declaration
public bool AllowLoadLocalInfile { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AllowLoadLocalInfileInPath
Gets or sets the safe path where files can be read and uploaded to the server.
Declaration
public string AllowLoadLocalInfileInPath { get; set; }
Property Value
Type | Description |
---|---|
System.String |
AllowPublicKeyRetrieval
Gets or sets a boolean value that indicates if RSA public keys should be retrieved from the server.
Declaration
public bool AllowPublicKeyRetrieval { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This option is only relevant when SSL is disabled. Setting this option to true
in
8.0 servers that have the caching_sha2_password authentication plugin as the default plugin will
cause the connection attempt to fail if the user hasn't successfully connected to the server on a
previous occasion.
AllowUserVariables
Gets or sets a boolean value that indicates if the provider expects user variables in the SQL.
Declaration
public bool AllowUserVariables { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
AllowZeroDateTime
Gets or sets a boolean value that indicates if zero date time values are supported.
Declaration
public bool AllowZeroDateTime { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
AutoEnlist
Gets or sets a boolean value that indicates if an opened connection should particiapte in the current scope.
Declaration
public bool AutoEnlist { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is true
.
BlobAsUTF8ExcludePattern
Gets or sets the pattern to match for the columns that should not be treated as UTF8.
Declaration
public string BlobAsUTF8ExcludePattern { get; set; }
Property Value
Type | Description |
---|---|
System.String |
BlobAsUTF8IncludePattern
Gets or sets the pattern to match for the columns that should be treated as UTF8.
Declaration
public string BlobAsUTF8IncludePattern { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CacheServerProperties
Gets or sets a boolean value that indicates whether the server variable settings are updated by a SHOW VARIABLES command each time a pooled connection is returned.
Declaration
public bool CacheServerProperties { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
CheckParameters
Gets or sets a boolean value that indicates if stored routine parameters should be checked against the server.
Declaration
public bool CheckParameters { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is true
.
CommandInterceptors
Gets or sets the list of interceptors that can intercept command operations.
Declaration
public string CommandInterceptors { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ConnectionLifeTime
Gets or sets the lifetime of a pooled connection.
Declaration
public uint ConnectionLifeTime { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Remarks
Default value is 0.
ConnectionReset
Gets or sets a boolean value that indicates if the connection should be reset when retrieved from the pool.
Declaration
public bool ConnectionReset { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
ConnectionTimeout
Gets or sets the connection timeout.
Declaration
public uint ConnectionTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
ConvertZeroDateTime
Gets or sets a boolean value that indicates if zero datetime values should be converted to DateTime.MinValue.
Declaration
public bool ConvertZeroDateTime { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
DefaultAuthenticationPlugin
Gets or sets the default authentication plugin to be used. This plugin takes precedence over the server-side default authentication plugin when a valid authentication plugin is specified.
Declaration
public string DefaultAuthenticationPlugin { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The default authentication plugin is mandatory for supporting user-less and password-less Kerberos authentications. If no value is set, it uses the server-side default authentication plugin.
DefaultCommandTimeout
Gets or sets the default command timeout.
Declaration
public uint DefaultCommandTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
DefaultTableCacheAge
Gets or sets the seconds for how long a TableDirect result should be cached.
Declaration
public int DefaultTableCacheAge { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Default value is 0.
ExceptionInterceptors
Gets or sets the list of interceptors that can triage thrown MySqlExceptions.
Declaration
public string ExceptionInterceptors { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FunctionsReturnString
Gets or sets a boolean value that indicates if server functions should be treated as returning a string.
Declaration
public bool FunctionsReturnString { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
IncludeSecurityAsserts
Gets or sets a boolean value that indicates if security asserts must be included.
Declaration
public bool IncludeSecurityAsserts { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Must be set to true
when using the MySqlClientPermission class in a partial trust environment,
with the library installed in the GAC of the hosting environment. Not supported in .NET Core.
Default value is false
.
IntegratedSecurity
Gets or sets a boolean value that indicates if the connection should be encrypted.
Declaration
public bool IntegratedSecurity { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Obsolte. Use MySqlSslMode instead.
InteractiveSession
Gets or sets a boolean value that indicates if the session should be interactive.
Declaration
public bool InteractiveSession { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
Item[String]
Gets or sets a connection option.
Declaration
public override object this[string keyword] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | keyword | The keyword that identifies the connection option to modify. |
Property Value
Type | Description |
---|---|
System.Object |
Overrides
KerberosAuthMode
Gets or sets the mode value to be used in Kerberos authentication.
Declaration
public KerberosAuthMode KerberosAuthMode { get; set; }
Property Value
Type | Description |
---|---|
KerberosAuthMode |
Remarks
If AUTO (default value) is used, then it will try to log in using SSPI and then fallback to GSSAPI mode value in case of error.
Logging
Gets or sets a boolean value that indicates whether logging is enabled.
Declaration
public bool Logging { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
MaximumPoolSize
Gets or sets the maximum connection pool setting.
Declaration
public uint MaximumPoolSize { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Remarks
Default value is 100.
MinimumPoolSize
Gets the minimum connection pool size.
Declaration
public uint MinimumPoolSize { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Remarks
Default value is 0.
OciConfigFile
Gets or sets the OCI configuration file location.
Declaration
public string OciConfigFile { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The default values vary depending on the operating system. On Windows systems the value is '%HOMEDRIVE%%HOMEPATH%.oci\config'. For Linux and macOS systems it is '~/.oci/config'.
OciConfigProfile
Gets or sets the profile to use from the OCI configuration file.
Declaration
public string OciConfigProfile { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The default value is "DEFAULT".
OldGuids
Gets or sets a boolean value that indicates if items of data type BINARY(16) should be treated as guids.
Declaration
public bool OldGuids { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
OpenIdIdentityToken
Gets or sets the Identity Token to be used in OpenID Connect authentication.
Declaration
public string OpenIdIdentityToken { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
If OpenIdIdentityToken is set the value will be used to try to log in using OpenID Connect authentication.
PersistSecurityInfo
Gets or sets a boolean value that indicates if the password should be persisted in the connection string.
Declaration
public bool PersistSecurityInfo { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
PipeName
Gets or sets the name of the named pipe that should be used for communicating with MySQL.
Declaration
public string PipeName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property has no effect unless the ConnectionProtocol property has been set to NamedPipe.
Pooling
Gets or sets a boolean value indicating if connection pooling is enabled.
Declaration
public bool Pooling { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is true
.
ProcedureCacheSize
Gets or sets the size of the stored procedure cache.
Declaration
public uint ProcedureCacheSize { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Remarks
Default value is 25.
Replication
Gets or sets a boolean value that indicates if this connection will use replication.
Declaration
public bool Replication { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
RespectBinaryFlags
Gets or sets a boolean value that indicates if column binary flags set by the server are ignored.
Declaration
public bool RespectBinaryFlags { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is true
.
SharedMemoryName
Gets or sets the base name of the shared memory objects used to communicate with MySQL when the shared memory protocol is being used.
Declaration
public string SharedMemoryName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
SqlServerMode
Gets or sets a boolean value that indicates if SQL Server syntax should be allowed by supporting square brackets around symbols instead of backticks.
Declaration
public bool SqlServerMode { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
TableCaching
Gets or sets a boolean value that indicates if caching of TableDirect commands is enabled.
Declaration
public bool TableCaching { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
TreatBlobsAsUTF8
Indicates whether the driver should treat binary BLOBs as UTF8.
Declaration
public bool TreatBlobsAsUTF8 { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
TreatTinyAsBoolean
Gets or sets a boolean value that indicates if TINYINT(1) shound be treated as a BOOLEAN.
Declaration
public bool TreatTinyAsBoolean { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is true
.
UseAffectedRows
Gets or sets a boolean value that indicates if the server should report affected rows instead of found rows.
Declaration
public bool UseAffectedRows { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
UseCompression
Gets or sets a boolean value that indicates whether this connection should use compression.
Declaration
public bool UseCompression { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
UseDefaultCommandTimeoutForEF
Declaration
public bool UseDefaultCommandTimeoutForEF { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
UsePerformanceMonitor
Gets or sets a boolean value that indicates if the performance monitor hooks should be enabled.
Declaration
public bool UsePerformanceMonitor { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
UseUsageAdvisor
Gets or sets a boolean value that indicates if the Usage Advisor should be enabled.
Declaration
public bool UseUsageAdvisor { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is false
.
Methods
Clear()
Declaration
public override void Clear()
Overrides
ContainsKey(String)
Declaration
public override bool ContainsKey(string keyword)
Parameters
Type | Name | Description |
---|---|---|
System.String | keyword |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remove(String)
Declaration
public override bool Remove(string keyword)
Parameters
Type | Name | Description |
---|---|---|
System.String | keyword |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
TryGetValue(String, out Object)
Retrieves the value corresponding to the supplied key from this MySqlConnectionStringBuilder.
Declaration
public override bool TryGetValue(string keyword, out object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | keyword | The key of the item to retrieve. |
System.Object | value | The value corresponding to the |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|