Hi,
I'm facing an issue while trying to connect to a SQL Server with SSPI integrated security.
If my connection string uses "Integrated Security=SSPI", it is accepted by TUniConnection but seems not have any effect.
If my connection string uses "Authentication=Windows", it is refused by TUniConnection as "Authentication" is not a valid parameter name
Of course, if I set manually the specfic option "Authentication" = "auWindows", it works well but my goal is to control ALL connection parameters with the connection string.
My question is: did I do something wrong (some trick I missed somewhere) or is there a problem in UniDac 6.1.5 ?
(In next post, a sample app which shows the problem)
Using SSPI with SQL Server
-
- Posts: 10
- Joined: Tue 21 Jul 2015 07:43
Re: Using SSPI with SQL Server
Code: Select all
uses
System.SysUtils, uni, SQLServerUniProvider, ActiveX;
const
ConnectionStr = 'Provider Name=SQL Server;Data Source=XXXXX';
var
connection: TUniConnection;
begin
try
CoInitialize(nil);
connection := TUniConnection.Create(nil);
try
connection.LoginPrompt := False;
try
connection.ConnectString := ConnectionStr + ';Integrated Security=SSPI';
connection.Connect;
writeln('SSPI: connected');
except
writeln('SSPI: not connected = ' + Exception(ExceptObject).Message);
end;
try
connection.ConnectString := ConnectionStr + ';Authentication=Windows';
connection.Connect;
writeln('Authentication: connected');
except
writeln('Authentication: not connected = ' + Exception(ExceptObject).Message);
end;
try
connection.ConnectString := ConnectionStr + ';Integrated Security=SSPI';
connection.SpecificOptions.Values['SQL Server.Authentication'] := 'auWindows';
connection.Connect;
writeln('SSPI+Authentication: connected');
except
writeln('SSPI+Authentication: not connected = ' + Exception(ExceptObject).Message);
end;
finally
connection.Free;
CoUninitialize;
end;
readln;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
Code: Select all
SSPI: not connected = Login failed for user 'sa'.
Authentication: not connected = Connection parameter name is unknown: Authentication
SSPI+Authentication: connected
Re: Using SSPI with SQL Server
Thank you for the information. We have reproduced this problem and are investigating it. We will notify you about the results as any are available.