Restoring cached connections

When a user connects to OpenSwitch, the list of cached connections is searched, in an unspecified order, for the first connection owned by the same user name and password. If a cached connection is not found, a new connection is established as though caching were not enabled in the pool.

However, when a cached connection is found, the connection is re-established to the thread representing the newly connected user. The database context (transaction state) is then cleared to ensure that the new connection has a fresh context to work in, without any residual settings from the previous login session.