Skip to Content
author's profile photo Former Member
Former Member

SQL Query to find online users on HANA

Hello,

I'm trying to query all users that are online on a Hana instance for locking rows for edition. I've tried to query the SYS views M_CONNECTIONS and M_XS_SESSIONS but couldn't find any other user than mine connected while there are more connected users

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 25, 2015 at 07:23 AM

    This is an effect of lacking permissions.

    For a user to be able to see all session the account needs to have the CATALOG READ privilege.

    Add a comment
    10|10000 characters needed characters exceeded

    • Goodness... 😀

      Look, you seem to be building an application in which users can change data in a stateless UI environment.

      That means, there is typically no permanent record lock.

      So typically, what you would consider here is so-called optimistic locking.

      E.g. you could save version indicators or timestamps with your data and increase those whenever a record got changed. That way you could take the version information for the record your user wants to edit.

      On db level there wouldn't be a record lock at this point.

      Upon save time, you could go and compare the version indicator you fetched before with the one present in the table for your record.

      If they still match, you perform your db-update. If not, then someone else had already overwritten the record meanwhile.

      This of course makes it possible that two or more users spend time and effort entering data and only one of them will be able to save the result.

      Alternatively you would have to implement a central "logical lock" - very much what the ABAP enqueue does. That's not easy to get right and scalable, though.

      In any case, checking which other users are online in itself, is not getting you all that far.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.