Tuesday, December 4, 2007

Manage Connection pool

.net managerd providers manage the connection pool for us, using shared database connection. We can control the size of connection pool in connection string, for example:

const string connString = "server=localhost;" +
"uid=scott;" +
"pwd=tiger;" +
"database=Northwind;" +
"Min Pool Size=3;" +
"Max Pool Size=3";

What's that mean and what happened behind the scenes. When SqlConnection.Open() was called, the manager provider instantiatied an internal calls called SqlConnectionProolManger and invoked its GetpooledConnection method, passing into it the connection string. The pool manager examined all current pools to see if there was one that used a connection string that exactly matched the one it was given

No comments: