Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "pooling=false" in a MySQL connection string mean? [closed]

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;");
like image 596
Bruno Casali Avatar asked Aug 20 '13 13:08

Bruno Casali


2 Answers

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

like image 85
Rahul Tripathi Avatar answered Oct 21 '22 10:10

Rahul Tripathi


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.

like image 29
sircodesalot Avatar answered Oct 21 '22 11:10

sircodesalot