Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbLogon

Log on to FairCom Server or FairCom DB instance session.

Declaration

CTDBRET ctdbLogon(CTHANDLE Handle, pTEXT dbengine, pTEXT userid,

pTEXT password)

Description

ctdbLogon() logs on to the c-tree Server or FairCom DB instance. Before any database operation can take place, initiate a session with ctdbAllocSession() and then logon to the c-tree Server or c-tree Plus instance using ctdbLogon() before calling ctdbAllocDatabase().

Before logon to the c-tree Server or a FairCom DB instance, it is necessary to have a session dictionary. To create a session dictionary, use the function ctdbCreateSession().

  • Handle [in] the session handle.
  • dbengine [in] the string with the c-tree Server name or FairCom DB instance name. If dbengine is NULL ctdbLogon() uses the string "FAIRCOMS" as the default server name or c-tree Plus instance.
  • userid [in] the string with the user name. If userid is NULL ctdbLogon() uses the string " " as the default user name.
  • password [in] the string with the user password. If password is NULL ctdbLogon() uses the string " " as the default user password.

To logout from the c-tree Server or FairCom DB instance, use the ctdbLogout() function.

Returns

ctdbLogon() returns CTDBRET_OK on success, or FairCom DB API C API error code on failure.

Example


CTSESSION_TYPE ctdbsess=CTSESSION_CTDB;

CTHANDLE hSession = ctdbAllocSession(ctdbsess);

CTDBRET err;

err = ctdbLogon(hSession, "FAIRCOMS", "ADMIN", "ADMIN");

err = ctdbCreateDatabase(hSession, "MyDatabase", "");

err = ctdbLogout(hSession);

ctdbFreeSession(hSession);


See also

ctdbLogout(), ctdbAllocDatabase(), ctdbCreateSession(), ctdbIsActiveSession()

TOCIndex