blog

Home / DeveloperSection / Blogs / Connection Pooling in .Net

Connection Pooling in .Net

Amit Singh3531 02-Dec-2010

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


Updated 18-Sep-2014

Leave Comment

Comments

Liked By