Get the used provider

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
chkaufmann
Posts: 82
Joined: Sat 01 Jul 2006 11:42

Get the used provider

Post by chkaufmann » Mon 07 Jun 2021 07:30

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

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Get the used provider

Post by Stellar » Tue 29 Jun 2021 14:46

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;

Post Reply