Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 6 of 6 total |
How to limit # of users on shared database? |
Wed, Mar 7 2007 4:53 PM | Permanent Link |
Dave Harrison | Is there an easy way to limit the number of users who are on a shared
database (non-c/s?). The only thing I've come up with is to force the user to log in, and then if user limit has been exceeded, prevent the new user from logging in, or log out oldest user. Is there an easier way? (I just don't want 20 users logging into my application that is meant for 1 or 2 users.) TIA Dave |
Thu, Mar 8 2007 3:36 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Dave
If its a matter of not having to have the user log in why not just use a "silent login". You don't need user id or password, just use semaphore flags. The way I do it is on logon set the semaphore against the users table (any table could be used) having first checked that a limit has not been exceeded. Then on closing the app I if uLck <> -1 then DM.Users.UnlockSemaphore(uLck); So in your case when they start the app use SetSemaphore Dead easy. But will not work in ElevateDB (I think Tim said) All you need is somewhere to hold the allowed number of users. Roy Lambert procedure THHForm.SetSemaphore(uLim: integer); var SaveLockRetryCount: Integer; SaveLockWaitTime: Integer; begin SaveLockRetryCount := Session.LockRetryCount; SaveLockWaitTime := Session.LockWaitTime; try Session.LockRetryCount := 0; Session.LockWaitTime := 0; uLck := 1; while (uLck <= uLim) and (not DM.Users.LockSemaphore(uLck)) do Inc(uLck); if (uLck > uLim) then begin MessageDlg('The maximum number of users permitted has been exceeded. Please contact your supplier', mtInformation, [mbOk], 0); Application.Terminate; end; finally Session.LockRetryCount := SaveLockRetryCount; Session.LockWaitTime := SaveLockWaitTime; end; end; |
Thu, Mar 8 2007 10:46 AM | Permanent Link |
Dave Harrison | Roy,
Thanks for the code example. What happens if the user's machine reboots without a graceful exit? How long will the semaphore lock be held? There's two types of computer reboots to consider: the user accessing the database over the lan, and the user accessing the data locally. Will your semaphore locking handle reboots? TIA Dave |
Thu, Mar 8 2007 11:33 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Dave
> Thanks for the code example. What happens if the user's machine reboots >without a graceful exit? How long will the semaphore lock be held? >There's two types of computer reboots to consider: the user accessing >the database over the lan, and the user accessing the data locally. Will >your semaphore locking handle reboots? I've just tried it resetting a test app in the IDE, and ctrl-alt-del'ing the test app and it seems to work. I'm not going to take a hammer to my PC to really try it out Roy Lambert |
Thu, Mar 8 2007 1:00 PM | Permanent Link |
Dave Harrison | Roy Lambert wrote:
> Dave > > > >> Thanks for the code example. What happens if the user's machine reboots >>without a graceful exit? How long will the semaphore lock be held? >>There's two types of computer reboots to consider: the user accessing >>the database over the lan, and the user accessing the data locally. Will >>your semaphore locking handle reboots? > > > I've just tried it resetting a test app in the IDE, and ctrl-alt-del'ing the test app and it seems to work. I'm not going to take a hammer to my PC to really try it out > > Roy Lambert > Roy, Great, thanks for testing it out. I'll give it a whirl. Dave |
Thu, Mar 8 2007 5:28 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
< Dead easy. But will not work in ElevateDB (I think Tim said) >> EDB allows you to set the number of licensed users per configuration even with local apps. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Thursday, April 18, 2024 at 10:42 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |