IPrimaryMsSqlODBCSPLD.ODBCParams

Syntax

ODBCParams: String;

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 a link to the Metabase system assembly. In Fore.NET also add links to the WinForms.Utils system assembly.

Sub UserProc;
Var
    MbMan: IMetabaseManager;
    MbDefs: IMetabaseDefinitions;
    MbDef: IMetabaseDefinition;
    MssqlOdbcSPLD: IPrimaryMsSqlODBCSPLD;
Begin
    MbMan := MetabaseManagerFactory.Active;
    MbDefs := MbMan.Definitions;
    MbDef := MbDefs.Add;
    MbDef.DriverId := 
"MSSQL2012ODBC";
    MbDef.Id := 
"MSSQL_ODBC";
    MbDef.Name := 
"MSSQL_ODBC";
    MbDef.Authentication := AuthenticationMode.Password;
    MbDef.SecurityPackage := 
"STANDARDSECURITYPACKAGE";
    MssqlOdbcSPLD := MbDef.LogonData 
As IPrimaryMsSqlODBCSPLD;
    MssqlOdbcSPLD.Server := 
"MSSQLServer";
    MssqlOdbcSPLD.Database := 
"DataRepository";
    MssqlOdbcSPLD.ODBCParams := 
"MultiSubnetFailover=Yes;ApplicationIntent=ReadWrite";
    MbDef.Save;
End Sub UserProc;

Imports Prognoz.Platform.PiLibNet.Utils;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub UserProc();
Var
    ManagerFactory: IMetabaseManagerFactory;
    MbMan: IMetabaseManager;
    MbDefs: IMetabaseDefinitions;
    MbDef: IMetabaseDefinition;
    MssqlOdbcSPLD: IPrimaryMsSqlODBCSPLD;
Begin
    ManagerFactory := ComCreator.Instance.CoCreate<MetabaseManagerFactoryClass>();
    MbMan := ManagerFactory.Active;
    MbDefs := MbMan.Definitions;
    MbDef := MbDefs.Add();
    MbDef.DriverId := 
"MSSQL2012ODBC";
    MbDef.Id := 
"MSSQL_ODBC";
    MbDef.Name := 
"MSSQL_ODBC";
    MbDef.Authentication := AuthenticationMode.amPassword;
    MbDef.SecurityPackage := 
"STANDARDSECURITYPACKAGE";
    MssqlOdbcSPLD := MbDef.LogonData 
As IPrimaryMsSqlODBCSPLD;
    MssqlOdbcSPLD.Server := 
"MSSQLServer";
    MssqlOdbcSPLD.Database := 
"DataRepository";
    MssqlOdbcSPLD.ODBCParams := 
"MultiSubnetFailover=Yes;ApplicationIntent=ReadWrite";
    MbDef.Save();
End Sub;

After executing the example, a new description for connecting to the specified repository is created. The connection is implemented using the ODBC driver with the ability to set additional connection parameters.

See also:

IPrimaryMsSqlODBCSPLD