Distributed Tuning Interface Reference : PvDisconnectSQLConnection()
 
PvDisconnectSQLConnection()
Attempts to disconnect an active SQL connection by passing SQL connection Id. Use PvGetSQLConnectionsData and PvSQLConnectionInfo to obtain a valid connection Id.
Note Each SQL connection also establishes a MicroKernel Engine connection. Use PvDisconnectMKDEClient to kill those connections.
Header File: monitor.h (See also Header Files)
Function First Available In Library: w3dbav75.dll (Windows), libpsqldti.so (Linux), libpsqldti.dylib (macOS) (See also Link Libraries)
Syntax
BTI_SINT PvDisconnectSQLConnection(
   BTI_LONG           hConnection,
    PVSQLCONNID*       pSQLConnId);
Arguments
 
In
hConnection
Server connection handle that contains the SQL connection to be disconnected. Server connection handles are obtained with the PvConnectServer() function.
In
pSQLConnId
Address of the PVSQLCONNID structure to identify the SQL connection. SQL connections are obtained with the PvGetSQLConnectionsData()
Return Values
 
P_OK
The operation was successful.
P_E_INVALID_HANDLE
Invalid connection handle.
P_E_DATA_UNAVAILABLE
Data related to active clients not available.
P_E_NULL_PTR
Call with NULL pointer.
P_E_INVALID_CLIENT
Invalid client ID.
P_E_FAIL
Failed to disconnect to the named server.
Example
BTI_SINT status = 0;
PVSQLCONNINFO connectionInfo;
PVSQLCONNID connId;
status = PvGetSQLConnectionsData (connection, &count);
while (count > 0)
{
status = PvGetSQLConnectionInfo(connection, 0,
&connectionInfo);
connId.u132ProcessId =
connectionInfo.u132ProcessId;
connId.u132ThreadId =
connectionInfo.u132ThreadId;
status = PvDisconnectSQLConnection(connection,
&connId);
status = PvGetSQLConnectionsData (connection,
&count);
}
PvFreeSQLConnectionsData(connection, &count);
Remarks
The following preconditions must be met:
DTI session started by calling PvStart()
Connection established by PvConnectServer() or if you are performing the operation on a local machine, P_LOCAL_DB_CONNECTION may be used as the connection handle.
See Also
PvStart()
PvConnectServer()
PvGetSQLConnectionsData()
PvGetSQLConnectionInfo()
PvDisconnect()
PvStop()