IPrimaryODBCSPLD.ODBCParams

Syntax

ODBCParams: String;

Description

The ODBCParams property determines a string of additional parameters values.

Comments

Parameters and their values are specified as parameter1=value1;parameter2=value2.......

Example

The operating system must have Microsoft SQL Server ODBC driver installed. The network has a server named MSSQLServer, the DataRepository schema is created on the server.

Add links to the Db and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    DB: IDatabase;
    LogonData: IPrimaryODBCSPLD;
    PasswordCreds: IPasswordCredentials;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE;
    CrInfo.Id := 
"ODBC_DB";
    CrInfo.Name := 
"Connect via ODBC";
    CrInfo.Parent := MB.Root;
    MObj := MB.CreateObject(CrInfo).Edit;
    DB := MObj 
As IDatabase;
    DB.Authentication := AuthenticationMode.Password;
    DB.DriverId := 
"ODBC";
    LogonData := DB.LogonData 
As IPrimaryODBCSPLD;
    LogonData.ODBCParams := 
"DRIVER={ODBC Driver 13 for SQL Server};SERVER=MSSQLServer;DATABASE=DataRepository";
    DB.LoginPrompt := False;
    PasswordCreds := DB.Credentials 
As IPasswordCredentials;
    PasswordCreds.UserName := 
"User";
    PasswordCreds.Password := 
"Password";
    MObj.Save;
End Sub UserProc;

After executing the example, a new database is created in the repository root folder, which allows for connecting to data sources via Microsoft SQL Server ODBC driver.

See also:

IPrimaryODBCSPLD