Reports connection property information.
sa_conn_info( [ connidparm ] )
Column name | Data type | Description |
---|---|---|
Number | INTEGER |
Returns the connection ID (a number) for the current connection. |
Name | VARCHAR(255) |
Returns the connection ID (a number) for the current connection. Temporary connection names have INT: prepended to the connection name. |
Userid | VARCHAR(255) |
Returns the user ID for the connection. |
DBNumber | INTEGER |
Returns the ID number of the database. |
LastReqTime | VARCHAR(255) |
Returns the time at which the last request for the specified connection started. This property can return an empty string for internal connections, such as events. |
ReqType | VARCHAR(255) |
Returns the type of the last request. If a connection has been cached by connection pooling, its ReqType value is CONNECT_POOL_CACHE. |
CommLink | VARCHAR(255) |
Returns the communication link for the connection. This is one of the network protocols supported by SAP Sybase IQ, or local for a same-computer connection. |
NodeAddr | VARCHAR(255) | Returns the address of the client in a client/server connection. |
ClientPort | INTEGER |
Returns the client's TCP/IP port number or 0 if the connection isn't a TCP/IP connection. |
ServerPort | INTEGER |
Returns the database server's TCP/IP port number or 0. |
BlockedOn | INTEGER |
Returns zero if the current connection isn't blocked, or if it is blocked, the connection number on which the connection is blocked because of a locking conflict. |
LockRowID | UNSIGNED BIGINT |
Returns the identifier of the locked row. LockRowID is NULL if the connection is not waiting on a lock associated with a row (that is, it is not waiting on a lock, or it is waiting on a lock that has no associated row). |
LockIndexID | INTEGER |
Returns the identifier of the locked index. LockIndexID is -1 if the lock is associated with all indexes on the table in LockTable. LockIndexID is NULL if the connection is not waiting on a lock associated with an index (that is, it is not waiting on a lock, or it is waiting on a lock that has no associated index). |
LockTable | VARCHAR(255) | Returns the name of the table associated with a lock if the connection is currently waiting for a lock. Otherwise, LockTable returns an empty string. |
UncommitOps | INTEGER | Returns the number of uncommitted operations. |
ParentConnection | INTEGER |
Returns the connection ID of the connection that created a temporary connection to perform a database operation (such as performing a backup or creating a database). For other types of connections, this property returns NULL. |
If connidparm is less than zero, then a result set consisting of connection properties for the current connection is returned. If connidparm is not supplied or is NULL, then connection properties are returned for all connections to all databases running on the database server.
In a block situation, the BlockedOn value returned by this procedure allows you to check which users are blocked, and who they are blocked on. The sa_locks system procedure can be used to display the locks held by the blocking connection.
For more information based on any of these properties, you can execute something similar to the following:
SELECT *, DB_NAME( DBNumber ), CONNECTION_PROPERTY( 'LastStatement', Number ) FROM sa_conn_info( );
The value of LockRowID can be used to look up a lock in the output of the sa_locks procedure.
The value in LockIndexID can be used to look up a lock in the output of the sa_locks procedure. Also, the value in LockIndexID corresponds to the primary key of the ISYSIDX system table, which can be viewed using the SYSIDX system view.
Every lock has an associated table, so the value of LockTable can be used to unambiguously determine whether a connection is waiting on a lock.
No privileges are required to execute this system procedure for the current connection ID. To execute this system procedure for other connections, you must have either the SERVER OPERATOR, MONITOR, or DROP CONNECTION system privilege.
None
The following example uses the sa_conn_info system procedure to return a result set summarizing connection properties for all connections to the server.
CALL sa_conn_info( );
Number | Name | Userid | DBNumber | ... |
---|---|---|---|---|
79 | SQL_DBC_10dcf810 | DBA | 0 | ... |
46 | setup | User1 | 0 | ... |
... | ... | ... | ... | ... |
The following example uses the sa_conn_info system procedure to return a result set showing which connection created a temporary connection.
SELECT Number, Name, ParentConnection FROM sa_conn_info();
Connection 8 created the temporary connection that executed a CREATE DATABASE statement.
Number Name ParentConnection ------------------------------------------------ 1000000048 INT: CreateDB 8 9 SQL_DBC_14675af8 (NULL) 8 SQL_DBA_152d5ac0 (NULL)