Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection Lifetime=0 in MySql connection string

What exactly does Connection Lifetime=0 mean in a connection string?

like image 517
Quintin Par Avatar asked Aug 05 '09 14:08

Quintin Par


2 Answers

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.

like image 129
Lawrence Johnston Avatar answered Sep 29 '22 12:09

Lawrence Johnston


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

like image 39
Myra Avatar answered Sep 29 '22 11:09

Myra