MySqlConnection class

MySqlConnection represents a connection to a MySQL database.

public sealed class MySqlConnection : DbConnection, ICloneable

Public Members

MySqlConnection()The default constructor.
CanCreateBatch { get; }
override ConnectionString { get; set; }
override ConnectionTimeout { get; }Gets the time (in seconds) to wait while trying to establish a connection before terminating the attempt and generating an error. This value is controlled by ConnectionTimeout, which defaults to 15 seconds.
override Database { get; }
override DataSource { get; }
ServerThread { get; }The connection ID from MySQL Server.
override ServerVersion { get; }
override State { get; }
event InfoMessage
BeginTransaction()Begins a database transaction.
BeginTransaction(…)Begins a database transaction. (2 methods)
BeginTransactionAsync(…)Begins a database transaction asynchronously. (3 methods)
override ChangeDatabase(…)
override ChangeDatabaseAsync(…)
CloneWith(…)Returns an unopened copy of this connection with a new connection string. If the Password in connectionString is not set, the password from this connection will be used. This allows creating a new connection with the same security information while changing other options, such as database or pooling.
override Close()
override CloseAsync()
CreateBatch()Creates a MySqlBatch object for executing batched commands.
CreateBatchCommand()Creates a MySqlBatchCommand object (that can be used with BatchCommands).
override DisposeAsync()
override EnlistTransaction(…)
override GetSchema()
override GetSchema(…)(2 methods)
GetSchemaAsync(…)Asynchronously returns schema information for the data source of this MySqlConnection.
override Open()
override OpenAsync(…)
ResetConnectionAsync(…)Resets the session state of the current open connection; this clears temporary tables and user-defined variables.
static ClearAllPools()Clears all connection pools.
static ClearAllPoolsAsync(…)Asynchronously clears all connection pools.
static ClearPool(…)Clears the connection pool that connection belongs to.
static ClearPoolAsync(…)Asynchronously clears the connection pool that connection belongs to.

Protected Members

override DbProviderFactory { get; }
override BeginDbTransaction(…)
override BeginDbTransactionAsync(…)
override CreateDbCommand()
override Dispose(…)

See Also