Author: Qing Dujun
Address: http://blog.csdn.net/qingdujun/article/details/36425825
When SQL Server 2008 + VS2010 uses code written in C # To restore the database, an error occurs:
Error message:
A transmission error occurs when sending a request to the server. (Provider: Shared Memory provider, error: 0-there is no process on the other end of the MPs queue.
Solution:
Construct the SQL link statement as follows:
string strLink = @"server=.;database=DataBaseName;uid=sa;pwd=123456;pooling=false";
The above is the same, but a pooling = false is added to the backend. The connection pool is not used.
----------------------------------------
Analysis description:
In fact, we have been using the SqlServer connection pool. In the connection string, Pooling indicates whether to enable the connection pool. The default value is true, indicating that the connection pool is enabled.
Two important parameters related to the connection Pool are Min Pool Size and Max Pool Size, which are the minimum number of connections in the Pool and the maximum number of connections in the Pool. The default values are 0 and 100, respectively.
When we create a connection instance and call the Open () method, the connection pool administrator finds an available connection in the connection pool. when the Close () method is called, the connection pool manager returns the connection to the connection pool for the next call of the Open () method.
In addition, the Connection Lifetime in the Connection string sets the lifecycle for the Connection in the Connection pool. The default value is 0. When the Connection is returned to the pool, the creation time is compared with the current time. If the length of time (in seconds) exceeds the value specified by Connection Lifetime, the connection will be destroyed. This is useful in clustering configuration (used to force load balancing between running servers and servers that are just online ). If the value is zero, the connection pool has the maximum connection timeout.
From the above understanding, we can see that even the simplest connection string is using the connection pool.
Reference: Baidu knows that a transmission-level error occurs when a request is sent to the server. (Provider: Shared Memory provider, error: 0-No [CP/OL]. http://zhidao.baidu.com/question/1573456795577498260.html,2013-09-27/2014-07-02 on the other end of the MPs queue.
Qi Fei's Blog. SQL Server connection pool and its usage [CP/OL]. http://www.cnblogs.com/youring2/archive/2011/06/18/2084442.html,2011-06-18/2014-07-02.