Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 7 of 7 total |
Current Server active/connected sessions? |
Mon, Mar 25 2019 7:27 PM | Permanent Link |
Ian Branch | Hi Team,
In C/S Mode, I want to be able to get the count of the current active/connected Server sessions there are at any point in time. I tried using TEDBEngine.SessionCount but that only seems to give me the count for the App rather than total sessions. I also tried TEDBEngine.GetServerConnectedSessionCount but that always gives me 0. Is there something I have missed in trying to use these functions? I am thinking I have to do a SQL extract/count of Server Sessions but hoping there is an easier way. Regards & TIA, Ian |
Mon, Mar 25 2019 7:28 PM | Permanent Link |
Ian Branch | Should have said. D10.3.1, EDB 2.31b1.
|
Tue, Mar 26 2019 1:07 AM | Permanent Link |
Steve Gill | Hi Ian,
<< In C/S Mode, I want to be able to get the count of the current active/connected Server sessions there are at any point in time. I tried using TEDBEngine.SessionCount but that only seems to give me the count for the App rather than total sessions. I also tried TEDBEngine.GetServerConnectedSessionCount but that always gives me 0. Is there something I have missed in trying to use these functions? I am thinking I have to do a SQL extract/count of Server Sessions but hoping there is an easier way. >> I tend to do most things using stored procedures and functions. I'm not sure if this helps but I use this function to display session counts: CREATE FUNCTION "GetSessionCount" () RETURNS INTEGER BEGIN DECLARE TempCursor SENSITIVE CURSOR FOR SQLStatement; DECLARE SessionCount INTEGER; PREPARE SQLStatement FROM 'SELECT COUNT(*) AS SessionCount FROM Configuration.ServerSessions WHERE User <> ''Administrator'' AND Connected = True'; OPEN TempCursor; IF (ROWCOUNT(TempCursor) > 0) THEN FETCH FIRST FROM TempCursor('SessionCount') INTO SessionCount; ELSE SET SessionCount = 0; END IF; CLOSE TempCursor; RETURN SessionCount; END = Steve |
Tue, Mar 26 2019 2:18 AM | Permanent Link |
Ian Branch | Hi Steve,
That can work. I haven't created/used server based functions before. How is this then called from Delphi? Regards, Ian |
Thu, Mar 28 2019 6:16 PM | Permanent Link |
Steve Gill | Hi Ian,
<< That can work. I haven't created/used server based functions before. How is this then called from Delphi? >> Just drop a TEDBStoredProc component on the datamodule or form and set the StoredProcName to the function name (see attached image). Then call it using code like this: spGetSessionCount.Prepare; spGetSessionCount.ExecProc; SessionCount := spGetSessionCount.ParamByName('Result').AsInteger; spGetSessionCount.UnPrepare; = Steve Attachments: GetSessionCount.png |
Sun, Mar 31 2019 7:23 PM | Permanent Link |
Ian Branch | Thanks Steve,
Chalk up another first. First time I have used a Stored Procedure. Procedure & Component. Thanks for the education. Regards, Ian |
Mon, Apr 1 2019 2:53 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Ian,
<< I also tried TEDBEngine.GetServerConnectedSessionCount but that always gives me 0. >> That property only works if the TEDBEngine instance is acting as a server and you're accessing the property from the server process itself. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Monday, May 6, 2024 at 12:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |