edmiRemoteSetUnavailable

EdmiError edmiRemoteSetUnavailable(SdaiServerContext serverContextId,
                                     SdaiString        password, 
                                     SdaiString        unavailableMessage, 
                                     SdaiInvocationId  *edmiInvocationId);


Sets an EDMdatabase unavailable for new connections. The EDMdatabase will remain unavailable until the edmiRemoteSetAvailable function is invoked. It will remain unavailable even when the database is closed and reopened.  Thick EDMclients trying to connect to an unavailable EDMdatabase will receive an optional message specified by the system administrator in the last call to this function. Use this message to explain to the connecting EDMclients why the EDMdatabase has been set unavailable. This function is only available for the superuser.

Arguments


TypeNameComment
SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

SdaiString

password

The password for the superuser. If the superuser is defined as the calling user in the server context, this argument may be omitted.

SdaiString

unavailableMessage

The message that will be returned to any thick EDMclient that tries to connect to the EDMdatabase as long as it remains unavailable.

SdaiInvocationId

edmiInvocationId

Currently not used.

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


  

 

Example


 

 int i;
 EdmiError rstat;
 SdaiServerContext suContext;
 tEdmiWhoIsOnServer *pWhoIsOn;
 tEdmiConnection *pConnect;
 SdaiInteger nConnect;
  
 /* Define Remote Server Context
 for the superuser */ 
 rstat = edmiDefineServerContext("SuperUserContext",
 "superuser", NULL, "xfx56kl9",
 "TCP", "9090", "MyServerHost",
 NULL, NULL, NULL, NULL, NULL, &suContext); 
  
 /* Set system unavailable */
 rstat = edmiRemoteSetUnavailable(suContext,
 "System unavailable due to maintenance",  
 NULL, NULL); 
  
 /* Kill all the thick EDMclients except for those
 connected as superuser. Do not kill any of the  
 EDMapplicationServer processes. Other superuser  
 connections shall be forced to terminate. */ 
 rstat = edmiRemoteWhoIsOn(suContext, &nConnect, &pWhoIsOn, NULL);
 pConnect = pWhoIsOn->connections;
  
 for (i=0;i<nConnect;i++) {
 SdaiString _hostName, _clientName, _userName; 
  
 /* Do not kill your own client connection */ 
 if (pConnect->clientId != pWhoIsOn->myClientId) { 
 rstat = edmiRemoteGetClientNames(suContext,  
 pConnect->clientId, &_hostName,  
 &_clientName, NULL); 
  
 /* Do not kill EDMapplicationServer processes */ 
 if (!strstr(_clientName, "EDMapplicationServer-")) { 
 rstat = edmiRemoteGetAttrs(suContext,  
 pConnect->userId, 0, 1, NULL,  
 "NAME", sdaiSTRING, &_userName); 
  
 /* Check if superuser owns connection */  
 if (strcmp(_userName, "superuser")) { 
 /* No mercy!! Kill any connection  
 not owned by the superuser */ 
 rstat = edmiRemoteTerminateClient(suContext, NULL,  
 pConnect->clientId, KILL_CLIENT, NULL); 
 } else { 
 /* Handle superuser clients with care, 
 i.e force them to terminate */ 
 rstat = edmiRemoteTerminateClient(suContext, NULL,  
 pConnect->clientId, FORCE_TO_TERMINATE, 
 NULL); 
 } 
 } 
 } 
 ++pConnect; 
 }
 . . . 

 

See also

Filter by label

There are no items with the selected labels at this time.

Â