Revision history:
Introduced in QPR 7.2.1
Last changed in QPR 8.2
Connect to application server. If QPR Metrics client is already connected to server, then the existing connection is closed first. The server address and port must be named, i.e. they must be found on the Server Connections list of the QPR Metrics client.
Synopsis:
SCApplication.ConnectToServer(ServerAddress, Port)
Parameters:
ServerAddress: String, name or IP address of the server. The used address must be identical to the Host address defined in the QPR Metrics client Server Properties. For example: if the Host is defined as a host name in QPR Metrics client, the same host name must be used in the script, i.e. the IP address cannot be used with that connection.
Port: Integer, portnumber. The port number must be identical to the port number defined in the QPR Metrics client Server Properties.
Required Rights:
None
Return Values:
Below are listed the return values that this function can return:
RV_INVALID_PORT_NUMBER
RV_CANCELLED
RV_SUCCESS
RV_CANNOT_SAVE_SERVERADDRESS
RV_CANNOT_CONNECT_TO_SERVER
Example Procedure:
Sub ConnectToServerAndAuthenticate()
Dim iResult
Dim oModel
iResult = SCApplication.ConnectToServer("127.0.0.1", 2618)
If (iResult <> 0) Then
MsgBox "Could not connect to default server: " + SCApplication.GetErrorMessage(iResult)
End If
iResult = SCApplication.Authenticate("qpr", "demo", "")
If (iResult <> 0) Then
MsgBox "Authentication failed: " + SCApplication.GetErrorMessage(iResult)
End If
End Sub