Page 1 of 1

Get the used provider

Posted: Mon 07 Jun 2021 07:30
by chkaufmann
I connect to MS SQL Server with the default provider option "prAuto".

Once the connection is established, how can I find out which provider (Native, OLEDB, SQL, direct) was found and used in my connection?

Christian

Re: Get the used provider

Posted: Tue 29 Jun 2021 14:46
by Stellar
SDAC doesn't provide information about which provider was used to connect, but you can find out about the used client:

Code: Select all

uses
  MSClasses;

procedure TForm1.Button1Click(Sender: TObject);
var
  St: String;
  MSSQLConnection: TMSSQLConnection;
begin
  MSSQLConnection := TMSSQLConnection(TDBAccessUtils.GetIConnection(MSConnection));

  if MSConnection.Connected then begin
    St := MSSQLConnection.GetServerVersionFull;
    if st <> ':' then
      Memo1.Lines.Add(St);
  end;
  if (MSConnection.Options.Provider <> prCompact) and
     (MSConnection.Options.Provider <> prDirect)
  then begin
    St := MSSQLConnection.GetClientVersionFull + ': ' + MSSQLConnection.GetClientVersion;
    if St <> ': ' then
      Memo1.Lines.Add(St);
  end;
end;