ADO.NET数据库连接池
we specify the pooling characteristics in the connection string when the SqlConnection is constructed, as shown in the following code sample. Please note: Pooling is implicit, you automatically get it unless you disable it. Therefore, "true" is the default for the pooling keyword (pooling=true).
String connString;
// Specification in the connection string:
// Please note: Pooling is implicit, you automatically get it unless you disable it.
// Therefore, "true" is the default for the pooling keyword (pooling=true).
// Connection Reset: False
// Connection Lifetime: 5
// Enlist: true
// Min Pool Size: 1
// Max Pool Size: 50
connString = "server=(local)\NetSDK;Integrated Security=SSPI;database=northwind;" +
"connection reset=false;" +
"connection lifetime=5;" +
"min pool size=1;" +
"max pool size=50";
// Specification in the connection string:
// Please note: Pooling is implicit, you automatically get it unless you disable it.
// Therefore, "true" is the default for the pooling keyword (pooling=true).
// Connection Reset: False
// Connection Lifetime: 5
// Enlist: true
// Min Pool Size: 1
// Max Pool Size: 50
connString = "server=(local)\NetSDK;Integrated Security=SSPI;database=northwind;" +
"connection reset=false;" +
"connection lifetime=5;" +
"min pool size=1;" +
"max pool size=50";