I am writing a Delphi client app & custom RO/DA server to be installed within an organisation. Certain database lookup tables are subject to national standards (and thus alteration).
The server apps do not have Internet access, therefore, I am desigin the client app to automatically update the lookup tables. BUT I only want one client to run this process rather than have ALL clients attempt it (all the users tend to log on to the app at the same time, so there is db/server latency to take into account)
When you use TRODBSessionManager/TDADBSessionManager you could determine if some client is already connected to the server by analizing Sessions data table. In the case of proper way sessions creating/deleting you could just check if there is at least one session record in Sessions table and don’t run updating.
Hi Elena - thanks for your reply, I had just worked out a similar solution. When I asked the question I entirely forgot that I could just query the data table
But - I’m having a problem; not all sessions are being deleted on my server. Most of the time it’s working fine, but I have noticed a few session records remain after 10-20 logins/logouts.
Is there anything that would prevent the session from deleting? I’ve not had any client app or server app crashes? I cannot reliably replicate it, so any pointers would be very useful.
Thanks.
Stuart
PS - When I first examined the session_manager table after roughly 12 months of having this database, there were 577 records in the session_manager table.
As a workaround, when querying the session_manager table I am adding a clause that only looks for records where [Created] is within the last 8 hours (which will exclude older non-deleted records) and more or less guarantees that one user will get tagged to run any updates.
Realised flaw in my workaround - if there’s always a user logged in, then no-one gets to be the first user. Changing my logic to be “first user that day”.
stuartclennett said: But - I'm having a problem; not all sessions are being deleted on my server. Most of the time it's working fine, but I have noticed a few session records remain after 10-20 logins/logouts.
Is there anything that would prevent the session from deleting?
I can’t reproduce such situation if proper logouts were done.
Maybe exiting application without logout occurs sometimes? Or some other situation that could cause disconnecting client without logout? In our Session Types sample if you close client app without logout - session remains in data table.
Check also SessionDuration and SessionCheckInterval values - maybe something wrong with them and SessionManager doesn’t delete expired sessions.