Connector/Net Programming
1903
Connector/Net will automatically create, open, close and destroy connections, using the connection
pooling system for best performance.
Typed Datasets and the
MembershipProvider
and
RoleProvider
classes use this approach. Most
classes that have methods that take a
MySqlConnection
as an argument, also have methods that
take a connection string as an argument. This includes
MySqlDataAdapter
.
Instead of manually creating
MySqlCommand
objects, you can use the static methods of the
MySqlHelper
class. These take a connection string as an argument, and they fully support
connection pooling.
Resource Usage
Starting with MySQL Connector/Net 6.2, there is a background job that runs every three minutes
and removes connections from pool that have been idle (unused) for more than three minutes. The
pool cleanup frees resources on both client and server side. This is because on the client side every
connection uses a socket, and on the server side every connection uses a socket and a thread.
Prior to this change, connections were never removed from the pool, and the pool always contained
the peak number of open connections. For example, a web application that peaked at 1000 concurrent
database connections would consume 1000 threads and 1000 open sockets at the server, without ever
freeing up those resources from the connection pool. Note, connections, no matter how old, will not be
closed if the number of connections in the pool is less than or equal to the value set by the
Min Pool
Size
connection string parameter.
20.2.5.5. Using the Windows Native Authentication Plugin
Connector/Net applications can authenticate to a MySQL server using the Windows Native
Authentication Plugin as of Connector/Net 6.4.4 and MySQL 5.5.16/5.6.10. Users who have logged in
to Windows can connect from MySQL client programs to the server based on the information in their
environment without specifying an additional password. For background and usage information about
the authentication plugin, see,
The Windows Native Authentication Plugin
.
The interface matches the
MySql.Data.MySqlClient
object. To enable, pass in
Integrated
Security
to the connection string with a value of
yes
or
sspi
.
Passing in a user ID is optional. When Windows authentication is set up, a MySQL user is created and
configured to be used by Windows authentication. By default, this user ID is named
auth_windows
,
but can be defined using a different name. If the default name is used, then passing the user ID to
the connection string from Connector/Net is optional, because it will use the
auth_windows
user.
Otherwise, the name must be passed to the
connection string
using the standard user ID element.
20.2.5.6. Writing a Custom Authentication Plugin
Advanced users with special security requirements can create their own authentication plugins for
Connector/Net applications. You can extend the handshake protocol, adding custom logic. This
capability requires Connector/Net 6.6.3 or higher, and MySQL 5.5.16 or higher. For background and
usage information about MySQL authentication plugins, see,
Authentication Plugins
and
Writing
Authentication Plugins
.
To write a custom authentication plugin, you will need a reference to the assembly
MySql.Data.dll
.
The classes relevant for writing authentication plugins are available at the namespace
MySql.Data.MySqlClient.Authentication
.
How the Custom Authentication Plugin Works
At some point during handshake, the internal method
void Authenticate(bool reset)
of
MySqlAuthenticationPlugin
is called. This method in turns calls several overridable methods
of the current plugin.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...