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

萝らか妹 提交于 2019-12-01 16:46:11

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.

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