Opens a remote EDMdatabase from a thin EDMclient. The EDMdatabase will be attached to the EDMserver specified in the given server context. An EDMdatabase may not be accessed until it is opened by a call to this function.
In a single-user system the EDMserver is embedded in the EDMinterface. In a multi-user system the EDMserver and the EDMclients will be running as separate processes, possibly on different systems.
The EDMserver may not handle more than one EDMdatabase at the time. Any open EDMdatabase must therefore be closed before opening another.
This operation is protected with the EDMdatabase password. This password is defined when the EDMdatabase is created.
Related functions: edmiRemoteCreateDatabase, edmiRemoteCloseDatabase , edmiOpenDatabase
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteOpenDatabase (SdaiServerContext serverContextId,
SdaiString location,
SdaiString databaseName,
SdaiString password);
Arguments:
serverContextId |
Context identification, from edmiDefineServerContext |
location |
The full path to the directory on the remote file system where the EDMdatabase is located. The directory delimiter is '/' on UNIX platforms and '\' on Windows platforms. |
databaseName |
The name of the _EDMdatabase_ to open. _EDMdatabase_ names are case sensitive on UNIX platforms and case insensitive on Windows platforms. |
password |
The password for the EDMdatabase. The password is defined by the edmiCreateDatabase function. |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
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 the system unavailable */
rstat = edmiRemoteSetUnavailable(suContext,
"System unavailable due to maintenance",
NULL, NULL);
rstat = edmiRemoteWhoIsOn(suContext, &nConnect, &pWhoIsOn, NULL);
pConnect = pWhoIsOn->connections;
/* Kill all connections except the
EDMapplicationServer processes */
for (i=0;i<nConnect;i++) {
SdaiString _hostName, _clientName;
rstat = edmiRemoteGetClientNames(suContext,
pConnect->clientId, &_hostName,
&_clientName, NULL);
if (!strstr(_clientName, "EDMapplicationServer-")) {
rstat = edmiRemoteTerminateClient(suContext, NULL,
pConnect->clientId, FORCE_TO_TERMINATE, NULL);
}
++pConnect;
}
/* Close the database */
rstat = edmiRemoteCloseDatabase(suContext, "db546tyz", NULL);
/* Perform system maintenance here */
/* Reopen the database */
rstat = edmiRemoteOpenDatabase(suContext, "x:/mypro/db",
"mydb", "db546tyz");
/* Set the system available for
connections from EDMclients */
rstat = edmiRemoteSetAvailable(suContext, NULL, NULL);
. . .