What exactly does Connection Lifetime=0
mean in a connection string?
views:
1073answers:
4It means there is no connection time out period. For example if it is set 300 if in this time query is not completed, let's say because there is lot of data, a time out exception will be thrown. When it is say 0 it will work until query is completed.
In addition, When you use Connection LifeTime: It destroys pooled connections If the time your connection is opened for is larger than Connection LifeTime,connection is not usable.
I suggest that using Connection LifeTime if you have not a connection within a cluster of server
Based on my research I believe that Myra is the closest of the other answers.
It is not the same as the connection timeout.
Instead see this pseudocode from this article:
On SqlConnection.Close
Check if time the connection has been open is greater than Connection Lifetime if it is, throw the connection away
Else Put connection on the pool
The same article explains why you would rarely want to use this property (and the situations in which you might).
Note that it has been renamed to "Load Balance Timeout" in an attempt to clarify its behavior per the above article.