Icon View Incident Report

Serious Serious
Reported By: Ulrich Doewich
Reported On: 7/25/2008
For: Version 2.01 Build 1
# 2717 Executing a CREATE JOB Statement that Inclues a USE Statement Causes Subsequent Lock Failures

My server runs as a service, so I've placed my database init code in the ServiceStart procedure. Everything had been fine so far, but after adding the following job definition, the following code will no longer finish and cause the service to hang on startup, forcing me to use task manager to shut it down.

It may have something to do with the 'USE xxx' instructions of the JOB, because when I comment out the code in the JOB it starts up fine; adding only the 'USE' instructions causes the service to hang again.

Create job code:

SQL.Text := 'SELECT * FROM Jobs WHERE Name=' + 
EDBEngine1.QuotedSQLStr('Maintenance');
Open; // check if the job already exists
if RecordCount = 0 then begin
   Close;
   SQL.Clear;
   SQL.Add('CREATE JOB Maintenance');
   SQL.Add('RUN AS "System"');
   SQL.Add('FROM DATE ''2008-01-05'' TO DATE ''2108-01-06''');
   SQL.Add('EVERY 1 DAYS');
   SQL.Add('BETWEEN TIME ''02:00 AM'' AND TIME ''02:14 AM''');
   SQL.Add('BEGIN');
   SQL.Add('   USE RCS;');
   SQL.Add('   CALL ProcPurgeLog;');
   SQL.Add('   CALL ProcGenerateUpdates;');
   SQL.Add('   USE;');
   SQL.Add('END');
   {$IF Defined(DEBUG)}
   AddToLog('creating "Maintenance" job');
   {$IFEND}
   ExecSQL;
   {$IF Defined(DEBUG)}
   AddToLog('  success');
   {$IFEND}
end
else begin
   {$IF Defined(DEBUG)}
   AddToLog('"Maintenance" job already exists');
   {$IFEND}
   Close;
end;

Publish code:

if Config.Gen_PrimaryServer then begin
   SQL.Text := 'PUBLISH DATABASE "RCS"';
   {$IF Defined(DEBUG)}
   AddToLog('publishing the database');
   {$IFEND}
   ExecSQL;
   {$IF Defined(DEBUG)}
   AddToLog('  success');
   {$IFEND}
end;



Comments Comments
The CREATE JOB was not releasing a lock on the database being referenced in the USE statement.


Resolution Resolution
Fixed Problem on 7/26/2008 in version 2.01 build 2


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image