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
Get the used provider
Re: Get the used provider
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;