views:

62

answers:

2

Hello:

I want to preview a report in a Delphi 7 program that connects to a SQL database. The 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!

A: 

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.

vgv8
+1  A: 

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).

moz