IConnectedUserInfoEx.SessionId

Syntax

SessionId: String;

Description

The SessionId property returns session identifier for the user connected to repository.

Example

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    Users: IConnectedUsersInfoEx;
    User: IConnectedUserInfoEx;
Begin
    
// Get repository
    MB := MetabaseClass.Active;
    
// Get active users connected to repository
    Users := MB.GetConnectedUsersEx;
    
// Display message in the console if connected users are missing
    If Users.Count = 0 Then
        Debug.WriteLine(
"No connected users");
    
Else
        
// Display information about each user in the console   
        For Each User In Users Do
            
// Display platform user name
            Debug.WriteLine("DBMS user: " + User.UserName);
            
// Display OS user name
            Debug.WriteLine("OS user: " + User.UserOsName);
            
// Display workstation name
            Debug.WriteLine("Workstation: " + User.HostName);
            
// Display network MAC address of computer
            Debug.WriteLine("Network MAC address of computer: " + User.NetAddress);
            
// Display user session identifier
            Debug.WriteLine("Session ID: " + User.SessionId);
            Debug.WriteLine(
"=========================================");
        
End For;
    
End If
End Sub UserProc;

After executing the example information about each user is displayed in the console: platform user name, OS user name, workstation name, network MAC address of computer and user session identifier. If there are no connected users, a message will be displayed in the console.

The example of displaying information about connected users:

=========================================

DBMS user: ADMIN

OS user: petr.petrov

Workstation: PETROV

Network MAC address of computer: A0-E3-23-D5-E6-84

Session ID: 78

=========================================

DBMS user: ADMIN

OS user: ivan.ivanov

Workstation: IVANOV

Network MAC address of computer: AC-22-0B-C8-6A-C4

Session ID: 93

=========================================

See also:

IConnectedUserInfoEx