What is the purpose of connection pooling in ADO.NET?

Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process.

By default, the connection pool is created when the first connection with a unique connection string connects to the database. The pool is populated with connections up to the minimum pool size. Additional connections can be added until the pool reaches the maximum pool size.

When a user request a connection, it is returned from the pool rather than establishing new connection and, when a user releases a connection, it is returned to the pool rather than being released. But be sure than your connections use the same connection string each time. Here is the Syntax

conn.ConnectionString = "integrated Security=SSPI; SERVER=192.168.0.123; DATABASE=MY_DB; Min Pool Size=4;Max Pool Size=40;Connect Timeout=14;";

3 comments:

  1. thanks for the info pal!

    ReplyDelete
  2. Good ASP.Net tutorial for project work
    Check it....

    ctrlcvprogrammer.blogspot.com

    ReplyDelete
  3. very informative blog and useful article thank you for sharing with us , keep posting learn more about Dot net
    .NET Online Training Bangalore

    ReplyDelete

Type more interview question answer here