Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread Error 506. Again...
Thu, May 25 2023 6:14 PMPermanent Link

Ian Branch

Avatar

Hi Team,
I have this code..
{code}
     try
       //
       while true do
       begin
         //
         if TEDBEngineSessionManager(DBSWhoIsOn.Handle).TryLock(1) then
         begin
           TEDBEngineSessionManager(DBSWhoIsOn.Handle).Unlock;
           { Session is not locked and is safe for you to use }
           tqServerSessions.ExecSQL;
           Break;
           //
         end
         else
           // Delay for the specified amount of time
           Sleep(500);
         //
       end;
       //
     except
{code}
tqServerSessions executes this..
{sql}
SELECT runsum(1), * FROM Configuration.ServerSessions
Group by ID
order by ID
{sql}
Despite the TryLock/Unlock for the session manager, I still occasionally get.."ElevateDB Error #506 Cannot lock the session manager (ID: 17)." errors when tqServerSessions executes.  Frown
Can I test in the sql if Configuration.ServerSessions is in use/locked?

Regards & TIA,
Ian

Image