sa_conn_activity system procedure

Returns the most recently-prepared SQL statement for each connection to the specified database on the server.

Syntax
sa_conn_activity( [ connidparm ] )
Arguments
  • connidparm   Use this optional INTEGER parameter to specify the ID number of a connection.

Result set
Column name Data type Description
Number INT The ID number of the connection.
Name VARCHAR(255) The name of the connection.
Userid VARCHAR(255) The user ID for the connection.
DBNumber INT The ID number of the database.
LastReqTime VARCHAR(255) The time at which the last request for the specified connection started.
LastStatement LONG VARCHAR The most recently-prepared SQL statement for the connection.
Remarks

The sa_conn_activity system procedure returns a result set consisting of the most recently-prepared SQL statement for each connection, if the server has been told to collect the information. Recording of statements must be enabled for the database server prior to calling sa_conn_activity. To do this, specify the -zl option when starting the database server, or execute the following:

CALL sa_server_option('RememberLastStatement','ON');

This procedure is useful when the database server is busy and you want to obtain information about the last SQL statement prepared for each connection. This feature can be used as an alternative to request logging.

For information about the LastStatement property, from which these values are derived, see Connection-level properties.

If connidparm is not specified, then information is returned for all connections to all databases running on the database server. If connidparm is less than zero, option values for the current connection are returned.

Permissions

None

Side effects

None

See also