skip to main content
Using the driver : Connection Pool Manager : Using reauthentication
  

Try DataDirect Drivers Now

Using reauthentication

The driver supports reauthentication for Microsoft SQL Server.
Note: Reauthentication is not supported for SQL Server Azure, Azure Synapse Analytics, or Analytics Platform System (Parallel Data Warehouse).
You can configure a connection pool to provide scalability for connections. In addition, to help minimize the number of connections required in a connection pool, you can switch the user associated with a connection to another user, a process known as reauthentication.
For example, suppose you are using Kerberos authentication to authenticate users using their operating system user name and password. To reduce the number of connections that must be created and managed, you can use reauthentication to switch the user associated with a connection to multiple users. For example, suppose your connection pool contains a connection, Conn, which was established by the user ALLUSERS. That connection can service multiple users (User A, B, and C) by switching the user associated with the connection Conn to User A, B, and C.
The user performing the switch must have been granted the SQL Server database permission IMPERSONATE. In addition, before performing reauthentication, applications must ensure that any statements or result sets created as one user are closed before switching the connection to another user.
Your application can use the setCurrentUser() method in the ExtConnection interface located in the com.ddtek.jdbc.extensions package to switch a user on a connection. The setCurrentUser() method accepts driver-specific reauthentication options. The reauthentication options supported for the SQL Server driver are:
*CURRENT_DATABASE specifies the name of the current database. The value must be a valid Microsoft SQL Server database name.
If the setCurrentUser() method is called and this option is specified as an empty string or is not specified, only the user is switched; the database is not switched.
*REVERT_USER determines whether the driver reverts the current user to the initial user before setting the user to a new user for connections that have already reauthenticated.
*If set to true and the setCurrentUser() method is called, the driver reverts the current user to the initial user before setting the connection to the new user. For example, consider a connection that was initially created by User A and was later switched to User B. Before the connection could be further switched to User C, the driver reverts the connection back to User A and then sets it to User C.
*If set to false and the setCurrentUser() method is called, the driver does not revert the current user to the initial user before performing the switch. For example, if the connection was initially created by User A, switched to User B, and then switched to User C, the driver does not revert the user to User A before switching to User C.