Subject Re: Limiting number of user connections
Author Adam
--- In firebird-support@yahoogroups.com, "norgepaul"
<paul.thornton@c...> wrote:
>
> Hi,
>
> I have a problem that I hope somebody can help with.
>
> We're using Firebird 2.0 and need to limit the number of users that
> can connect to the database. The way we need to do it is:
>
> Say, for example, our customer is allowed 10 simultaneous users to the
> database at one time. Each application can generate several
> connections, but these connections should only count as one connection
> when calculating the number of connections against the licence.
>
> e.g. The following connections should count as three connections
> against the licence:
>
> IP Address USER
> 10.1.1.1 JOHN |
> 10.1.1.1 JOHN |- Counts as one connection
> 10.1.1.1 JOHN _|
> 192.168.1.1 JOHN |
> 192.168.1.1 JOHN _|- Counts as one connection
> 10.1.1.1 FREDRICK |
> 10.1.1.1 FREDRICK |
> 10.1.1.1 FREDRICK |- Counts as one connection
> 10.1.1.1 FREDRICK |
> 10.1.1.1 FREDRICK _|
>

To my knowledge there is no record of the connecting IP address
available. There is a context variable called CURRENT_USER, so you
could when your application starts insert a record into the table with
the IP / Mac address as well as CURRENT_USER. This could be the
primary key even, obviously ignoring pk violations when connecting.

You will need to have a mechanism to deal with 192.168.1.1 crashing
before it could log out John etc. One possibility is to have a
timestamp when the user is connected and delete any record where the
stamp is over some length of time old. Of course your application
would then need to freshen its timestamp periodically.

Actually, I just read you are using FB 2, I am not sure what new
features are available in this regard, check the release notes.

Adam