Subject | [SPAM] [firebird-support] Re: Fire Bird Database connection issues. |
---|---|
Author | Adam |
Post date | 2006-04-07T04:13:12Z |
--- In firebird-support@yahoogroups.com, "Jeremy Lim (Tm)"
<lim2000@...> wrote:
http://groups.yahoo.com/group/firebird-support/message/73638
You still seem to think Firebird has some mechanism for this. It
doesn't. The Firebird license allows for an unlimited number of
connections, the internal limit is 1024, but this is only an
implementation restriction. It may increase at some point in time.
YOU need to CREATE the table if you want it. After you have created
it, you may insert into it and delete from it as required. You can
count the records in it, and decide if a connection has been abandoned.
absence of activity for a period of time is considered abandonned.
Such a mechanism would require your program to periodically update a
record (aka keep-alive). If you notice a really old record, then you
assume it is abandoned.
A suggestion
Create a table
activeusers
(
connectionnumber integer,
lastcheckedin timestamp
);
Login Process:
Delete from activeusers where connectionnumber = CURRENT_CONNECTION;
Delete from activeusers where lastcheckedin < CURRENT_TIMESTAMP - (1/24);
select count(*) from activeusers
That will tell you how many users are in there. If you are below the
limit, continue on, otherwise show an error and exit.
Insert into activeusers values (CURRENT_CONNECTION, CURRENT_TIMESTAMP);
commit;
In Main Screen Using a TTimer or equivalent, every 20 minutes:
update activeusers
set lastcheckedin = CURRENT_TIMESTAMP
where connectionnumber = CURRENT_CONNECTION;
commit;
It is not bullet proof due to isolation, but it should be good enough
for what you need.
Adam
<lim2000@...> wrote:
>record when
> can you give me some sample or guideline on hwo to start for example
> where to insert record when new connection and where to delete
> user logoutThis thread has some possible ideas:
http://groups.yahoo.com/group/firebird-support/message/73638
You still seem to think Firebird has some mechanism for this. It
doesn't. The Firebird license allows for an unlimited number of
connections, the internal limit is 1024, but this is only an
implementation restriction. It may increase at some point in time.
YOU need to CREATE the table if you want it. After you have created
it, you may insert into it and delete from it as required. You can
count the records in it, and decide if a connection has been abandoned.
> and how to check for idle???You can't check for idle. You can only check for activity, and the
absence of activity for a period of time is considered abandonned.
Such a mechanism would require your program to periodically update a
record (aka keep-alive). If you notice a really old record, then you
assume it is abandoned.
A suggestion
Create a table
activeusers
(
connectionnumber integer,
lastcheckedin timestamp
);
Login Process:
Delete from activeusers where connectionnumber = CURRENT_CONNECTION;
Delete from activeusers where lastcheckedin < CURRENT_TIMESTAMP - (1/24);
select count(*) from activeusers
That will tell you how many users are in there. If you are below the
limit, continue on, otherwise show an error and exit.
Insert into activeusers values (CURRENT_CONNECTION, CURRENT_TIMESTAMP);
commit;
In Main Screen Using a TTimer or equivalent, every 20 minutes:
update activeusers
set lastcheckedin = CURRENT_TIMESTAMP
where connectionnumber = CURRENT_CONNECTION;
commit;
It is not bullet proof due to isolation, but it should be good enough
for what you need.
Adam
>issues.
> ----- Original Message -----
> From: "Adam" <s3057043@...>
> To: <firebird-support@yahoogroups.com>
> Sent: Thursday, April 06, 2006 7:30 AM
> Subject: [SPAM] [firebird-support] Re: Fire Bird Database connection
>address
>
> > Of course, but as you have already said, if the connection is
> > abandoned (someone just switches off their PC), this record will
> > remain in the database.
> >
> > You will need to create some mechanism, perhaps a keep-alive update of
> > the record could be sent from your application every 10 minutes. Your
> > connection counter can remove connection records if they are more than
> > 20 minutes old.
> >
> > But Firebird does not have this ability natively. There is no need for
> > the database engine because the Firebird licensing allows unlimited
> > connections. If you want to introduce limitations for your application
> > licensing, you need to create tables and insert / update / delete
> > information yourself.
> >
> > Adam
> >
> >
> >
> >> when user login will had a record of from which pc name and ip
> >> and when user logout when delete it.not be
> >>
> >>
> >> ----- Original Message -----
> >> From: "Adam" <s3057043@>
> >> To: <firebird-support@yahoogroups.com>
> >> Sent: Wednesday, April 05, 2006 7:38 AM
> >> Subject: [SPAM] [firebird-support] Re: Fire Bird Database connection
> > issues.
> >>
> >>
> >> > > The reason is I don't want total user pass from a program
> >> > > it will not be correct example improple shutdown or
> >> > > etc the total user still will remains.
> >> > >
> >> > > What one want is how many connections from client
> >> > > connect to fire bird with from which pc name and ip address.
> >> >
> >> > And what I have tried to explain is that this information can
> >> > read through Firebird unless you pass it in.limit.
> >> >
> >> > You did not state that you were after some sort of connection
> >> > All you stated was that you wanted to know the current IPaddress and
> >> > computer name. The only way Firebird will return that to you isif you
> >> > store it against the current_connection in a table somewhere.wrote:
> >> >
> >> > You are going to have to maintain your own keep-alive mechanism for
> >> > crashes clients (which should hopefully be rare).
> >> >
> >> > Adam
> >> >
> >> >
> >> > >
> >> > > --- In firebird-support@yahoogroups.com, "Adam" <s3057043@>
> >> > > >TIBDatabase.Usernames
> >> > > > > FireBird 1.5 Super Server version, Delphi 7.
> >> > > > > I try to use Delphi "Interbase" components
> >> > > > > but only can get user name.functions.
> >> > > > >
> >> > > > > Because we need to know total users connected to server
> >> > > > > and from which pc and ip address.
> >> > > >
> >> > > > You will need to insert this information into a table from your
> >> > > > program when someone 'logs in'. There are reasonably simple
> > windows
> >> > > > calls for this information, and lots of sample Delphi
> >> > > >Address, but
> >> > > > > Is it possible to e.g dll to write the function to get
> >> > > > > local pc name and ip address and use user define function
> >> > > > > to call this dll.
> >> > > >
> >> > > > Well you could write a UDF to get the PC Name and IP
> >> > > thisinformation
> >> > > > will be executed on the database server and so will contain
> >> > > > information about the DATABASE SERVER. You don't want
> >> > > > about the server, you want information about the clients.09/03/2006
> >> > > >
> >> > > > > When everytime got user login a trigger
> >> > > > > to write this information to a table or variable.
> >> > > >
> >> > > > There is no trigger on a connection, but there is also nothing
> >> > > > stopping you from passing in this information from the login
> > screen.
> >> > > >
> >> > > > Adam
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> >
> >> > Visit http://firebird.sourceforge.net and click the Resources item
> >> > on the main (top) menu. Try Knowledgebase and FAQ links !
> >> >
> >> > Also search the knowledgebases at http://www.ibphoenix.com
> >> >
> >> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> >
> >> > Yahoo! Groups Links
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >
> >
> >
> >
> >
> >
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >
> > Visit http://firebird.sourceforge.net and click the Resources item
> > on the main (top) menu. Try Knowledgebase and FAQ links !
> >
> > Also search the knowledgebases at http://www.ibphoenix.com
> >
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > Internal Virus Database is out-of-date.
> > Checked by AVG Free Edition.
> > Version: 7.1.375 / Virus Database: 268.2.1/278 - Release Date:
> >
> >
>