Subject Re: [firebird-support] Controlling the Number of Simultaneous Users
Author Lee Jenkins
Dan Cooperstock wrote:
> 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?

The problem is that your licensing might be fairly easily circumvented through
the database, IMO.

I had a need to do what you're doing and simply created a TCP based "License
Manager" that runs as a service (or app depending on OS) on the server or master
computer. When workstations start the software, the software uses encrypted
communication to talk with the license manager to say basically "hey, can I
run?", the license manager says "well, only 4 out of 7 licenses are being used
so sure!". The used count get incremented. When workstations shutdown the
software, the software logs into the license manager again to "log out" thereby
freeing up another license.

The license manager also tracks the IP of the workstation that gets clearance to
run so that if the workstation or license manager were to go down for some
reason, the license manager would read the IP of the incoming request when
restarted and determine that the workstation was already allowed to run.

All in all, works very well and I keep that logic out of the database. Of
course, a determined hacker/cracker would still be able to circumvent the system
with some work which I know from experience, but it serves its purpose well.

Warm Regards,


"My wife is better at Guitar Hero than I am and it's really irritating."