Hello,
We are using trial version of components for Delphi 5.
Two computer configuration in the domain: Developer computer and computer with SQL Server.
We have Service application on the developer computer.
In design mode we can connect to the SQL Server by setting in object inspector Connected := True on TMSConnection component. This works fine.
Trouble begin at attempting to start Service Application. The following code hang:
repeat
try
dbMain.Connected := true;
if dbMain.Connected then
Break;
except
on E: Exception do
begin
AddToLog('Connect failed with message: ' + E.Message);
end;
end;
sleep(5000); // 5 sec
inc(vCount);
Application.ProcessMessages;
until (vCount > (12 * 15)); // 15 min
The message that comes says: "Operation aborted".
Any ideas what is wrong?
Thank you very much.
Vladimir
Connect to SQL Server from Service Application
As far as I understand, the nag screen comes when Delphi is not started. But it came only by the first attempt to start Service, afterwards I didn't see it. I thought, the component has "remembered" the first start somewhere in the registry.
However, the Service never started (never came through the first connect). Besides of that, the checkbox for the Service allowing Data exchange with desktop is checked. Why should it be the problem?
However, the Service never started (never came through the first connect). Besides of that, the checkbox for the Service allowing Data exchange with desktop is checked. Why should it be the problem?
I am a registered SDAC user, and use SDAC in a heavily threaded Windows service application. I have never encountered any issues with SDAC when used in my service application. The problem is probably what Antaeus has stated - the nag screen has popped up, and probably does not have a parent form in which it can be displayed correctly.
I would suggest logging to a log file, in the OnServiceStart event, to check if the execution even reaches that far.
I would suggest logging to a log file, in the OnServiceStart event, to check if the execution even reaches that far.
Thank you for answer.
Yes, it comes so far. The code in my first post is inside the
function ConnectToDatabseWhenServiceStart that is called from
the handler OnServiceStart:
procedure TMC.ServiceStart(Sender: TService; var Started: Boolean);
begin
sDatabase := System.ParamStr(1);
sTablePrefix := System.ParamStr(2);
sUsername := System.ParamStr(3);
sPassword := Decrypt(HexStrToStr(System.ParamStr(4)), cCryptKey);
LogLevel := StrToIntDef(System.ParamStr(5), 0);
sPathLogFile := System.ParamStr(6);
dmMain := TdmMain.CreateDM(Application, bVisible, sPathLogFile);
if dmMain.ConnectToDatabseWhenServiceStart then
begin
...........
Started := True;
end
else
Started := False;
end;
Yes, it comes so far. The code in my first post is inside the
function ConnectToDatabseWhenServiceStart that is called from
the handler OnServiceStart:
procedure TMC.ServiceStart(Sender: TService; var Started: Boolean);
begin
sDatabase := System.ParamStr(1);
sTablePrefix := System.ParamStr(2);
sUsername := System.ParamStr(3);
sPassword := Decrypt(HexStrToStr(System.ParamStr(4)), cCryptKey);
LogLevel := StrToIntDef(System.ParamStr(5), 0);
sPathLogFile := System.ParamStr(6);
dmMain := TdmMain.CreateDM(Application, bVisible, sPathLogFile);
if dmMain.ConnectToDatabseWhenServiceStart then
begin
...........
Started := True;
end
else
Started := False;
end;
Guess it's the nag screen then. If you want to, you can send me your code (assuming it's just a small test app), and I can compile it for you using the registered version of SDAC 4.1, so that you can determine if its really an issue with the nag screen, assuming it's ok with the CoreLab people. BTW, I use Delphi 7.