SDAC

Connecting in Direct Mode

SDAC Professional Edition allows to connect to SQL Server in two ways: using the OLE DB interface or in the Direct mode via TCP/IP. The chosen connection mode is regulated by the TMSConnection.Options.Provider property.

SDAC connection modes

By default, SDAC, like most applications that work with SQL Server, uses the OLE DB interface directly through a set of COM-based interfaces to connect to server. Such approach allows using client applications on Windows workstations only.

To overcome these problems, SDAC Professional Edition includes an option to connect to SQL Server directly over the network using the TCP/IP protocol. This is referred to as connecting in the Direct mode. Connection in the Direct mode does not require OLEDB provider or SQL Native Client provider to be installed on target machines. The only requirement for running an SDAC-based application that uses the Direct mode is that the operating system must support the TCP/IP protocol.

Setting up Direct mode connections

Here is an example that illustrates connecting to SQL Server in the Direct mode. The server's IP address is 205.227.44.44, its port number is 1433 (this is the most commonly used port for SQL Server).

var
  MSConnection: TMSConnection;
. . .
  MSConnection.Options.Provider := prDirect;
  MSConnection.Authentication := auServer;
  MSConnection.Username := 'sa';
  MSConnection.Password := '';
  MSConnection.Server := '205.227.44.44';
  MSConnection.Port := 1433;
  MSConnection.Connect;

All we have to do is to set the TMSConnection.Options.Provider property to prDirect to enable Direct mode connections in your application. You do not have to rewrite other parts of your code.

Comparison of Client mode vs. Direct mode

Applications that use the OLE DB interface and those that use the Direct mode have similar size and performance. Security when using the Direct mode is the same as using the OLE DB interface.

Advantages of using the Direct mode

Direct mode limitations

© 1997-2019 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback