Wednesday, November 14, 2007

Connection Pooling in dotnet

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=127.0.0.1; DATABASE=test; Min Pool Size=4;Max Pool Size=40;Connect Timeout=20;";


 



1 comment:

Anonymous said...

hello... hapi blogging... have a nice day! just visiting here....