Changing user session information

The set command includes options that allow you to assign each client an individual name, host name, and application name. This is useful for differentiating among clients in a system where many clients connect to Adaptive Server using the same name, host name, or application name.

The partial syntax for the set command is:

set [clientname client_name | clienthostname host_name | clientapplname application_name]

where:

These parameters are stored in the clientname, clienthostname, and clientapplname columns of the sysprocesses table.

For example, if a user logs in to Adaptive Server as “client1,” you can assign them an individual client name, host name, and application name using commands similar to:

set clientname 'alison'
set clienthostname 'money1'
set clientapplname 'webserver2'

This user now appears in the sysprocesses table as user “alison” logging in from host “money1” and using the “webserver2” application. However, although the new names appear in sysprocesses, they are not used for permission checks, and sp_who still shows the client connection as belonging to the original login (in the case above, client1). set clientname does not perform the same function as set proxy, which allows you to assume the permissions, login name, and suid of another user.

You can set a client name, host name, or application name for only your current client session (although you can view the connection information for any client connection). Also, this information is lost when a user logs out. These parameters must be reassigned each time a user logs in. For example, the user “alison” cannot set the client name, host name, or application name for any other client connection.

Use the client’s system process ID to view their connection information. For example, if the user “alison” described above connects with a spid of 13, issue the following command to view all the connection information for this user:

select * from sysprocesses where spid = 13

To view the connection information for the current client connection (for example, if the user “alison” wanted to view her own connection information), enter:

select * from sysprocesses where spid = @@spid