Credentials: ICredentials;
The Credentials property returns the user credentials that are necessary for connecting to another repository.
This property is:
Relevant if the LoginPrompt property was set to False.
Not relevant if the UseMetabaseCredentials property was set to True.
If the credentials are specified for the repository description, then on saving the description they will be encrypted and saved to the registry of the operation system. Saved credentials can be used on impersonation of users during the connection to the repository in the application code.
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
Link: IMetabaseLink;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_METABASELINK;
CrInfo.Id := "Link_1";
CrInfo.Name := "Connection with Test1 repository";
CrInfo.Parent := MB.Root;
Link := MB.CreateObject(CrInfo).Edit As IMetabaseLink;
Link.Authentication := AuthenticationMode.Password;
Link.DriverId := "ORCL8";
Link.SecurityPackage := "STANDARDSECURITYPACKAGE";
Link.LogonData.ParamValue("SERVER") := "Test";
Link.LogonData.ParamValue("SCHEME") := "TestShema";
Debug.WriteLine(Link.LoginPrompt);
Link.LoginPrompt := False;
Link.Credentials.SlotValue("USERNAME") := "User1";
Link.Credentials.SlotValue("PASSWORD") := "password";
(Link As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the new object Connection with Repository is created in the repository root. This object connects with the repository that is placed on the Test server in the TestShema scheme. Password authentication, DBMS type installed on the server - Oracle 9.x or later are used on connection. The automatic connection with the specified credentials is established if this connection is used.
See also: