Subject Re: Limiting number of user connections
Author Adam
--- In, "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
> JOHN |
> JOHN |- Counts as one connection
> JOHN _|
> JOHN |
> JOHN _|- Counts as one connection
> FREDRICK |- Counts as one connection

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 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.