skip to main content
DataDirect tools : Connection Pool Manager : Configuring the connection pool : Using Reauthentication with the Pool Manager
  

Try DataDirect Drivers Now
Using Reauthentication with the Pool Manager
Reauthentication, or the ability to switch a user on a connection, is a useful strategy for minimizing the number of connections that are required in a connection pool. See "Using reauthentication" for an introduction to reauthentication.
If you are using the DataDirect Connection Pool Manager for connection pooling, you can enable reauthentication in the Pool Manager. By default, reauthentication is disabled. To enable reauthentication, call setReauthentication(enable) on the PooledConnectionDataSource. To disable reauthentication, call setReauthentication(disable).
The Pool Manager implements the maximum pool size, minimum pool size, and initial pool size attributes differently depending on whether reauthentication is enabled. For example, in both of the following figures, the maximum pool size is set to a value of 10, the minimum pool size is set to 5, and the initial pool size is set to 5.
The following figure shows a connection pool that is configured to work without reauthentication while using the default behavior for maximum pool size. When User A requests a connection, the Pool Manager assigns an available connection associated with User A. Similarly, if User B requests a connection, the Pool Manager assigns an available connection associated with User B. If a connection is unavailable for a particular user, the Pool Manager creates a new connection for that user. Because the maximum pool size is set to 10, a maximum of 10 idle connections can exist for each user. In this case, the total number of idle connections is 20, or 10 idle connections for each user.
Image showing two users with separate connections within the connection pool
The Pool Manager implements the minimum pool size and initial pool size in a similar way. The Pool Manager initially populates five connections for User A and five connections for User B, and ensures that, at a minimum, five idle connections are maintained in the pool for each user.
In contrast, the following figure shows a connection pool that is configured to work with reauthentication while using the default behavior for maximum pool size. The Pool Manager treats all connections as one group of connections. When User A requests a connection, the Pool Manager assigns an available connection associated with User A. Similarly, when User B requests a connection, the Pool Manager assigns an available connection associated with User B. If a connection is unavailable for a particular user, the Pool Manager assigns any available connection to that user, switching the user associated with the connection to the new user. In this case, the maximum number of idle connections in the pool is 10, regardless of how many users are using the connection pool.
Image showing two users with the same connections within the connection pool
The Pool Manager initially populates the pool with five connections and ensures that, at a minimum, five idle connections are maintained in the pool for all users.