What does pooling=false
in a .NET connection-string for a MySQL database mean?
This is the complete connection string:
return new MySqlConnection("SERVER=localhost;DATABASE=myDataBase;USER=###;PASSWORD=***;POOLING=FALSE;");
When pooling=false
the connection will not return to the pool when you call SqlConnection.Close()
From MSDN
When the value of this key is set to true, any newly created connection will be added to the pool when closed by the application. In a next attempt to open the same connection, that connection will be drawn from the pool. Connections are considered the same if they have the same connection string. Different connections have different connection string
Will the connection be part of a connection pool or not? This means that the connection be shared throughout the application instead of creating a new one every time you call open.
Note that for connection pooling to work, the connection string must be EXACTLY the same, meaning you cannot change a character in the string (even whitespace) and have pooling still work. Thus, the connection created by:
"SERVER=localhost;DATABASE=myDataBase;USER=###;PASSWORD=***;POOLING=FALSE;"
will not be shared with a connection created by:
" SERVER=localhost;DATABASE=myDataBase;USER=###;PASSWORD=***;POOLING=FALSE;"
because of the leading space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With