Subject | Re: [Firebird-Architect] On connect/disconnect trigger |
---|---|
Author | Milan Babuskov |
Post date | 2006-06-10T18:35:49Z |
outerostic wrote:
CREATE GENERATOR connect_id;
CREATE TABLE user_connection
(
username char(8),
id bigint
);
When application starts, it retrieves new ID from generator and updates user's
record. From time to time (or before each query) app. checks if ID it has
acquired upon starting is still the current for that user. If not, it forces user
to log off.
This part was to make sure each username has only one real human user at the time.
Next step is to add check for user count (same time ID is checked) for number of
concurent users you wish to support. If limit is reached, it takes the record in
user_connection with lowest ID and deletes it (same happens when app. is closed
gracefully). That way the "extra" users are forcedly logged off and those apps.
that were killed (or crashed) are cleaned up.
HTH
--
Milan Babuskov
http://www.flamerobin.org
> I'm not sure if this is the right forum for this question but II have a very simple mechanism for this. It may (or may not) work for you:
> thought I would put it out there. Would it be architectually correct
> and feasable to put a trigger on connection/disconnection to a
> database? It would make user management an almost trivial matter.
> (ie concurrent user license management etc).
CREATE GENERATOR connect_id;
CREATE TABLE user_connection
(
username char(8),
id bigint
);
When application starts, it retrieves new ID from generator and updates user's
record. From time to time (or before each query) app. checks if ID it has
acquired upon starting is still the current for that user. If not, it forces user
to log off.
This part was to make sure each username has only one real human user at the time.
Next step is to add check for user count (same time ID is checked) for number of
concurent users you wish to support. If limit is reached, it takes the record in
user_connection with lowest ID and deletes it (same happens when app. is closed
gracefully). That way the "extra" users are forcedly logged off and those apps.
that were killed (or crashed) are cleaned up.
HTH
--
Milan Babuskov
http://www.flamerobin.org