Re: Session ID -- Again (How to implement single session login)
Posted in 1996
John H. Frantz wrote:
>
> Chao Y. Din wrote:
> >
> > Sorry for late response to an old issue: How to acquire session id?
> > ....
> > Chao Din
>
> This is a neat idea, but I have a couple of comments. First, I'm not sure if selecting
> the maximum session id is bullet-proof.
Actually, the discussion is meaningless now, because I just found DBINFO is available since ONLINE 6.0.
However, I still want to address some of the issues you brought up. First of all, I have never said our
approach is bullet-proof.
> It occurs to me that if the same user logs in
> twice at about the same time, one of the sessions might kill himself (no big deal in your
> particular case).
The senario cannot happen in our environment. Every user has his/her own computer and they can only use their
own account. They have to run to another computer in order to log in from two different computers and mess up
the max session id.
> Also there is the question of whether the maximum session id is
> guaranteed to be the the latest one.
I am sure there is no guarantee even before we start using the max session id. But I did not have a choice.
There
was no other way to implement that.
>
> A better way might be to find your session id by process id, as in:
>
> select sid from sysmaster:syssessions where pid = my_pid>
> You can also count sessions that don't have your pid. Getting the pid value is another
> story but it's trivial in i4gl or esqlc.
>
Your approach does not apply in our environment. Our clients are PCs runing Powerbuilder. Since clients talk
to server through I-NET and then TCP/IP session, pid is always "-1".
Chao