Home > DeveloperSection > Blogs > Connection Pooling in .Net

Connection Pooling in .Net


.NET .NET 
Ratings:
0 Comment(s)
 2093  View(s)
Rate this:

Connection pooling in .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

Syntax:

con.ConnectionString = "integrated Security=SSPI; SERVER=192.168.4.221; DATABASE=dbAmit; Min Pool Size=4;Max Pool Size=45;Connect Timeout=16;";

where con is sqlconnection object


Don't want to miss updates? Please click the below button!

Follow MindStick