Connects the calling application to the actual EDMserver with the specified EDMuser account and optionally a specified EDMgroup account.
An application must be connected to an EDMserver before any data in the actual EDMdatabase can be accessed. The edmiConnect function checks for legal EDMuser name, EDMgroup name and password combinations. If the connect request is accepted the actual user remains connected to the EDMserver until one of the following functions is invoked: edmiDisconnect , sdaiCloseSession , edmiCloseDatabase or the client process terminates in one way or another.
When an application invokes the sdaiOpenSession function before connecting to the EDMserver, the calling application will be automatically connected as user sdai-user belonging to group sdai-group. This implicit connection in the sdaiOpenSession function facilitates standard SDAI applications to connect to an EDMserver without changing the source program.
Related functions: edmiDisconnect , sdaiOpenSession , sdaiCloseSession , edmiCloseDatabase
Header:
#include "sdai.h"
Prototype:
EdmiError edmiConnect(SdaiString edmUserName,
SdaiString edmUserGroup,
SdaiString password,
SdaiString *unavailableMessage);
Arguments:
edmUserName |
Name of an existing EDMuser account in the actual EDMdatabase. EDMuser account names are case insensitive. |
edmUserGroup |
Name of an existing EDMgroup account in the actual EDMdatabase. It is legal to connect to an EDMserver with <edmUserGroup> = NULL (empty). In this case no check on "group access rights" will be performed in the actual session. Models created when the creating user is connected without an EDMgroup specification will not get any "group owner". |
password |
The password for the EDMuser specified by the <edmUserName> argument. Initially an EDMuser is created without any password. A password can be changed by the edmiDefinePassword function. |
unavailableMessage |
Address to variable that will receive the address of a message that is returned when the edmiConnect fails, due to the fact that the EDMserver has been set unavailable by the edmiSetUnavailable function. The string returned is the argument supplied in the last edmiSetUnavailable function. The text string is located in a temporary internal buffer and will be overwritten by the next EDMinterface call. |
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
EdmiError rstat;
SdaiString unavailable;
SdaiModel modelId;
. . .
if (rstat = edmiConnect ("hkd", "merci", "ixc94cxi", &unavailable)) {
/* Error in operation */
printf("\nError: %s in edmiConnect\n",
edmiGetErrorText(rstat));
goto error;
}
. . .