Search code examples
asp.net.netconnection-pooling

Connection pooling misunderstanding?


from here

enter image description here Im having trouble understanding

they say that ado.net does not include a connection pooling mechanism.

1) if im using a datareader class which uses the connection string from the web.config file - will it have / wont have a polling mechanism ?

2) if all of my sql connecting code is using the web.config connection string , will the connection pooling will be enabled ? or not ?

3) what is the default ?


Solution

  • The SQL Server and Oracle SQL providers implement connection pooling.

    ADO.NET as a framework does not have the concept - there is no ConnectionPool class, for example. If you look at the base classes of the database types, they do not have any connection pooling support - compare DbConnection to SqlConnection, for example.

    To answer your questions:

    1. If the provider has connection pooling implemented, it can using it. It depends on the provider you are using, not the connection string as such, though the connection pool settings are controlled through the connection string (if the provider has support for the options).

    2. The SQL Server and the Oracle providers are the ones implementing pooling - they will read the connection string settings, but whether connection pooling is available or not depends on the provider (if the connection string disables pooling and it is available in the provider, the provider will disable it).

    3. The default is to use connection pooling if available (this is provider dependent).