开发者

Report can't connect to SQL Server if Windows Authetication

开发者 https://www.devze.com 2023-01-20 01:26 出处:网络
I want to preview a report in a Delphi 7 program that connects to a SQL database. The开发者_如何学Go database can use SQL or Windows Authentication.

I want to preview a report in a Delphi 7 program that connects to a SQL database. The开发者_如何学Go database can use SQL or Windows Authentication.

If SQL Authentication my program do:

MyReportComponent.Connect.Server:=myServer;
MyReportComponent.Connect.UserId:=myUserId;
MyReportComponent.Connect.Password:=myPassword;
MyReportComponent.Connect.Database:=myDatabase;
MyReportComponent.Execute;

and everything works fine.

But if the server is using Windows Authentication there is no property in Connect to indicate it, and if I assign the UserId and Password in blank the report doesn't connect to the database!

Any Clue?

Thanks in advance!


It will depend on the actual database you're using. There will be some magic text you add to the ConnectionString property. For MS-SQL Server you might try:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;

If you're using OLE access like we are here. The Delphi connection wizard has a lot of the information you need built into it, so it is worth having a play with that. Especially in later Delphi versions, I'm not sure exactly how far Delphi7 goes (don't have a copy with me now, sorry).


In Windows Integrated authentication the user specifies his (her) username and password when (s)he logins to Windows. It is Windows who authenticates, not user (s)himself or application, using various mechanisms, depending on configuration and state of network, like Kerberos, NTLM2, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消