ODBCParams: String;
The ODBCParams property determines a string of additional parameters values.
Parameters and their values are specified as parameter1=value1;parameter2=value2.
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 Dal 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;
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: