Content deleted Content added
m Replace magic links with templates per local RfC and MediaWiki RfC |
→Pooling: Pooling is not the same thing as multiplexing. Multiplexing implies concurrent usage of a single connection. Pooling is simple reuse. |
||
Line 23:
The connection object obtained from the connection pool is often a [[Adapter pattern|wrapper]] around the actual database connection. The wrapper handles its relationship with the pool internally and hides the details of the pool from the application. For example, the wrapper object can implement a "close" method that can be called just like the "close" method on the database connection. Unlike the method on the database connection, the method on the wrapper may not actually close the database connection, but might instead return it to the pool. The application does not need to be aware of the connection pooling when it calls the methods on the wrapper object.
This approach encourages the practice of opening a connection in an application only when needed, and closing it as soon as the work is done, rather than holding a connection open for the entire life of the application. In this manner, a relatively small number of connections can service a large number of requests
In a [[Client–server model|client–server architecture]], on the other hand, a persistent connection is typically used so that server state can be managed. This "state" includes server-side [[Cursor (databases)|cursors]], {{clarify span|temporary products|date=September 2012}}, connection-specific functional settings, and so on.
|