Explain in detail the fundamental of connection pooling?

 Posted by ArticlesMaint on 9/17/2009 | Category: ADO.NET Interview questions | Views: 7550

When a connection is opened first time, a connection pool is created and is based on the exact match of the connection string given to create the connection object. Connection pooling only works if the connection string is the same. If the connection string is different, then a new connection will be opened, and connection pooling will not be used.

Connection Pooling action.

Let us try to explain the same pictorially. In the above figure, you can see there are three requests “Request1”, “Request2”, and “Request3”. “Request1” and “Request3” have same connection string so no new connection object is created for “Request3” as the connection string is same. They share the same object “ConObject1”. However, new object “ConObject2” is created for “Request2” as the connection string is different.

Note: - The difference between the connection string is that one has “User id=sa” and other has “User id=Testing”.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Sheonarayan on: 1/24/2013
Here is the typical example of Connection Pooling connection string in the Web.config file

<add name="ConnStr" connectionString="Server=;Database=rtcmain; UID=rfgser; Password=fdfdfdf;Connection Timeout=30; Min Pool Size=5; Max Pool Size=40;"/>


Login to post response