IDalODBCConnectionDescriptor.ODBCParams

Syntax

ODBCParams: String;

ODBCParams: String;

Description

The ODBCParams property determines a string of additional parameter values.

Comments

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

Example

The ODBC driver for Microsoft SQL Server must be installed in the operating system. There is a server named MSSQLServer in the network, the DataRepositorys schema is created on the server.

Add a link to the Dal system assembly. In Fore.NET also add links to the WinForms.Utils system assembly.

Sub UserProc;
Var
    Driver: IDalDriver;
    ConDesc: IDalConnectionDescriptor;
    Params: IDalConnectionDescriptorParams;
    Con: IDalConnection;
    ParamsODBC: IDalODBCConnectionDescriptor;
Begin
    
// Connection driver
    Driver := New DalMsSql2012ODBCDriver.Create As IDalDriver;
    
// Connection description
    ConDesc := Driver.CreateDescriptor;
    Params := ConDesc.Params;
    
// Set up connection parameters
    Params.Find("Host BSTR").Value := "MSSQLServer";
    Params.Find(
"Database").Value := "DataRepository";
    Params.Find(
"User Name").Value := "User";
    Params.Find(
"Password").Value := "Password";
    
// Additional connection parameters
    ParamsODBC := ConDesc as IDalODBCConnectionDescriptor;
    ParamsODBC.ODBCParams := 
"MultiSubnetFailover=Yes;ApplicationIntent=ReadOnly";
    Con := ConDesc.CreateConnection;
    Con.Open;
    
If Con.IsDisconnected Then
        Debug.WriteLine(
"No connection.");
    
Else
        Debug.WriteLine(
"Connected successfully.");
    
End If;
End Sub UserProc;

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

Public Shared Sub UserProc();
Var
    
// Connection driver
    Driver: IDalDriver = ComCreator.Instance.CoCreate<DalMsSql2012ODBCDriverClass>();
    ConDesc: IDalConnectionDescriptor;
    Params: IDalConnectionDescriptorParams;
    Con: IDalConnection;
    ParamsODBC: IDalODBCConnectionDescriptor;
Begin
    
// Connection description
    ConDesc := Driver.CreateDescriptor();
    Params := ConDesc.Params;
    
// Set up connection parameters
    Params.Find("Host BSTR").Value := "MSSQLServer";
    Params.Find(
"Database").Value := "DataRepository";
    Params.Find(
"User Name").Value := "User";
    Params.Find(
"Password").Value := "Password";
    
// Additional connection parameters
    ParamsODBC := ConDesc As IDalODBCConnectionDescriptor;
    ParamsODBC.ODBCParams := 
"MultiSubnetFailover=Yes;ApplicationIntent=ReadOnly";
    Con := ConDesc.CreateConnection();
    Con.Open();
    
If Con.IsDisconnected Then
        System.Diagnostics.Debug.WriteLine(
"No connection.");
    
Else
        System.Diagnostics.Debug.WriteLine(
"Connected successfully.");
    
End If;
End Sub;

After executing the example, a new connection to the specified server is created. The connection is implemented via ODBC driver with setting additional connection parameters. The connection result is displayed in the development environment console.

See also:

IDalODBCConnectionDescriptor