
You can also supply several connection string modifiers to control connection pooling behavior. Unless you explicitly disable it, the pooler optimizes the connections as they are opened and closed in your application. By default, connection pooling is enabled in the Microsoft SqlClient Data Provider for SQL Server. Pooling connections can significantly enhance the performance and scalability of your application.
#SQL SERVER CONNECTION STRING POOLING PASSWORD#
Different instances of SqlCredential will use different connection pools, even if the user ID and password are the same. When using ChangePassword, the SqlCredential instance affects the connection pool. Connections are also pooled based on whether they are enlisted in a transaction.

#SQL SERVER CONNECTION STRING POOLING WINDOWS#
Connections are separated into pools by connection string, and by Windows identity when integrated security is used. Microsoft SqlClient Data Provider for SQL Server keeps several pools at the same time, one for each configuration. Only connections with the same configuration can be pooled. Once the connection is returned to the pool, it is ready to be reused on the next Open call. When the application calls Close on the connection, the pooler returns it to the pooled set of active connections instead of closing it. If a pooled connection is available, it returns it to the caller instead of opening a new connection. Whenever a user calls Open on a connection, the pooler looks for an available connection in the pool. It manages connections by keeping alive a set of active connections for each given connection configuration. The pooler maintains ownership of the physical connection. To minimize the cost of opening connections, Microsoft SqlClient Data Provider for SQL Server uses an optimization technique called connection pooling.Ĭonnection pooling reduces the number of times that new connections must be opened. This means that during application execution, many identical connections will be repeatedly opened and closed.

In practice, most applications use only one or a few different configurations for connections. A physical channel such as a socket or a named pipe must be established, the initial handshake with the server must occur, the connection string information must be parsed, the connection must be authenticated by the server, checks must be run for enlisting in the current transaction, and so on. You need to add this parameter to each operation.Connecting to a database server typically consists of several time-consuming steps. If you need to track database operations on a per user basis, consider adding a parameter through which you can pass the user identity and manually log user actions in the database. This is because to support connection pooling, the connection strings must be identical.

