Getting Information About Sessions in Progress
Getting Information About Sessions in Progress
If your application is only one of several on a single Macintosh computer
connected to data servers, you can use the DBGetConnInfo and
DBGetSessionNum functions to obtain information about the sessions in
progress. If you know the session ID (which is returned by the DBInit
function when you open a session), you can use the DBGetConnInfo function
to determine the database extension being used, the name of the host system on
which the session is running, the user name and connection string that were
used to initiate the session, the time at which the session started, and the status
of the session. The status of the session specifies whether the data server is
executing a query or waiting for another query fragment, whether there is
output data available, and whether execution of a query ended in an error.
If you do not know the session ID, or if you want to get information about all
open sessions, you can specify a database extension and a session number when
you call the DBGetConnInfo function. Although there can be only one active
session with a given session ID, session numbers are unique only for a specific
database extension. Because the database extension assigns session numbers
sequentially, starting with 1, you can call the DBGetConnInfo function
repeatedly for a given database extension, incrementing the session number
each time, to obtain information about all sessions open for that database
extension. Your application need not have initiated the session to obtain
information about it in this fashion.
The DBGetSessionNum function returns the session number when you
specify the session ID. You can use this function to determine the session
numbers for the sessions opened by your own application. You might want this
information, for example, so you can distinguish your own sessions from those
opened by other applications when you use the DBGetConnInfo function to get
information about all open sessions.