Subject RE: [firebird-support] Controlling the Number of Simultaneous Users
Author Svein Erling Tysvær
A similar idea. Use a separate transaction for the '# of Users control' and never commit the update (same way as you use pessimistic locking). This way you can ascertain that only one person is allowed into your program and after a crash, the users will at worst have to wait a few hours to use the program again (until Firebird understands that the connection is lost and does a rollback).

To get five users to work like this, simply have five records to update. If you fail updating record 1, then try record 2 etc. and tell the user to upgrade his subscription if no records are available.

HTH,
Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Dan Cooperstock
Sent: 30. november 2007 17:40
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Controlling the Number of Simultaneous Users

I have a shareware application that is currently using only FB
embedded, so obviously it can only have one simultaneous user. I want
to provide an option to have simultaneous users, using the FB Server,
but I want to be able to control how many simultaneous users are
allowed, based on the license fees that the using organization has
paid for my software.

Are there any obvious ways to do this with Firebird?

The only thing that comes to mind immediately is to have a single row
table that all users update on connect, increasing a UsageCount field
by one (if the current value doesn't exceed the # of licensed users).
On disconnect, they would decrease the count by one.

Of course, this solution is extremely error prone - if the program
ever crashes, or the user reboots while it is running etc., the usage
count won't be decreased.

Any better ideas?

Also, one of the options will be to be licensed to use the FB Server
with only one simultaneous user, for users who want to keep their DB
file on a network server (since FB Embedded doesn't allow that). Is
there any special way to do that, some sort of single-user connection
to the server?

Thank you.