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

ぐ巨炮叔叔 提交于 2019-12-19 17:30:12

问题


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;");

回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/18336961/what-does-pooling-false-in-a-mysql-connection-string-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!