Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Who is using the database?
Thu, Mar 20 2014 6:08 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi

I'm sure that this has been discussed on the forum before, but I have been
unable to find anything.

I want to be able to tell if there are other users connected to the
database.  This is so that I can do operations like repair, optimise,
database restructuring and other functions that need exclusive access.

I have used "SELECT * FROM Configuration.LogEvents" and can see that logins
and logouts are logged but the user is NULL or Administrator (that's the
EDBManager).  My application logins are always User=NULL.

Is this because (at the moment) I am in File Server mode?

I open the database like this:-

   EDBSession.SessionType := stLocal;
   EDBSession.LoginUser := 'Jeff.Cook';
   EDBSession.LoginPassword := 'XXXXXXXX';
   EDBSession.Open;
   MyDatabase.Connected := True;

....  The user/password/open lines were added in the hope of solving the
problem, but still no username.

So I need a way of

1.  knowing what active sessions there are.   Hopefully f/s and c/s
2.  blocking new sessions - c/s I presume
3.  tossing live sessions off - c/s I presume
4.  allowing new sessions again   - c/s I presume again.

.... else I write something to control this myself - seems like a common
requirement so I'm hoping that there is something built into ElevateDB

Cheers

Jeff
--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

Fri, Mar 21 2014 4:07 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


In file server (which I use) there is no direct way to check if several people are logged in. I have my own login system and use an adaptation of Terry Swiers component (look in the extensions ng for EDB user count - cNovember 2008). The other alternative is to just try opening the table(s) in exclusive mode and see if it fails.

In C/S you can query for the number of connections.

Roy Lambert
Tue, Mar 25 2014 12:23 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< So I need a way of

1.  knowing what active sessions there are.   Hopefully f/s and c/s
2.  blocking new sessions - c/s I presume
3.  tossing live sessions off - c/s I presume
4.  allowing new sessions again   - c/s I presume again. >>

You can only manage sessions remotely with C/S.  These are the tables that
you need to deal with with C/S:

http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=ServerSessions_Table

And these are the statements that control them:

http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=DISCONNECT_SERVER_SESSION
http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=REMOVE_SERVER_SESSION

There's really no way to block any sessions from connecting, other than to
stop the server (Engine.Active:=False from the server itself).

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Mar 25 2014 4:27 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Thanks Roy and Tim for your responses

.... and apologies for my delay in responding.  I was leaving my reply until
I had converted to client/server, but other things have intervened and I am
just getting back to the project.

Unless things change, my plan is for c/s throughout - even single users will
be running c/s so that I can us JOBs to run automated replications and
backups etc.

Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

"Roy Lambert" <roy@lybster.me.uk> wrote in message
news:04B67C0B-BB39-4C16-BD09-DF068EE31B25@news.elevatesoft.com...
> Jeff
>
>
> In file server (which I use) there is no direct way to check if several
> people are logged in. I have my own login system and use an adaptation of
> Terry Swiers component (look in the extensions ng for EDB user count -
> cNovember 2008). The other alternative is to just try opening the table(s)
> in exclusive mode and see if it fails.
>
> In C/S you can query for the number of connections.
>
> Roy Lambert
>

Tue, Mar 25 2014 4:41 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi Tim

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:95B096B5-179F-4D1A-BA18-A6AD0A9BE2E6@news.elevatesoft.com...
> Jeff,
<snip>
> You can only manage sessions remotely with C/S.  These are the tables that
> you need to deal with with C/S:
>
> http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=ServerSessions_Table
>
> And these are the statements that control them:
>
> http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=DISCONNECT_SERVER_SESSION
> http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=REMOVE_SERVER_SESSION
>
> There's really no way to block any sessions from connecting, other than to
> stop the server (Engine.Active:=False from the server itself).
>

Presumably I can run a timer and check every few seconds for sessions and
squish them as they appear?

I'd be interested in how other people manage this sort of stuff.

e.g. I have a utility in my DBISAM version of the app that *users* can run
and check/repair and optimise tables.

This is works OK but trips up when it encounters a table that is in use.

People running round the (remote) office asking "are you still logged on to
the XXX system"  and the usual denials.  Shutting down the server in c/s
fixes it and rebooting the file server machine in f/s mode clobbers them
too - but that is a somewhat blunt instrument way of doing stuff.

For my backups in ancient DBISAM3, I do  a StartTransaction, zip up the
tables (VCLZip) and then do a Rollback - can I do the same in ElevateDB?

Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

Wed, Mar 26 2014 3:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


>Presumably I can run a timer and check every few seconds for sessions and
>squish them as they appear?
>
>I'd be interested in how other people manage this sort of stuff.
>
>e.g. I have a utility in my DBISAM version of the app that *users* can run
>and check/repair and optimise tables.
>
>This is works OK but trips up when it encounters a table that is in use.
>
>People running round the (remote) office asking "are you still logged on to
>the XXX system" and the usual denials. Shutting down the server in c/s
>fixes it and rebooting the file server machine in f/s mode clobbers them
>too - but that is a somewhat blunt instrument way of doing stuff.

I like that as a concept. However, in my file server apps everyone has to log in (managed by an appusercount) and who is logged in is displayed on the apps main page - no need to run round to much.

>For my backups in ancient DBISAM3, I do a StartTransaction, zip up the
>tables (VCLZip) and then do a Rollback - can I do the same in ElevateDB?

Why not just use BACKUP? Unless you have encrypted tables they'll get nicely compressed (encrypted ones generally aren't very compressible) and you can then use RESTORE to get things back. This can also back up the catalog which makes restoring much easier if you have to.

An other alternative is to use EXPORT and then zip up the output later. I use EXPORT / IMPORT to transfer data between live and development systems takes a bit longer but gets round metadata incompatibilities.

Finally if you want a hot swop type of system and have a second machine to use have a look at PUBLISH.

From the manual

When the backup executes, it obtains a read lock for the entire database that prevents any sessions from
performing any writes to any of the tables in the database until the backup completes. However, since
the execution of a backup is quite fast, the time during which the tables cannot be changed is usually
pretty small. To ensure that the database is available as much as possible for updating, it is
recommended that you backup the database to a file in a local store on a fast hard drive and then copy
the file to a store that references a CD, DVD, or other slower backup device outside of the scope of the
database being locked instead of creating the backup file directly in the store on the slower backup
device.

I read that as you don't need exclusive access (never tested it though) so could be handy for you. No need to kick people off.

Roy Lambert
Wed, Mar 26 2014 5:14 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

"Roy Lambert" <roy@lybster.me.uk> wrote in message
news:7743673D-CC95-4C43-8014-EAE28964EE68@news.elevatesoft.com...
<snip>
>
> I like that as a concept. However, in my file server apps everyone has to
> log in (managed by an appusercount) and who is logged in is displayed on
> the apps main page - no need to run round to much.

That's more or less what I do, though it isn't as prominently displayed as
yours.  BUT the problem is the non log off people who just turn their
machine off and go home.  They are still showing as logged on and there
isn't an easy way of knowing if they are really gone - specially a pain if
they are VPN users miles away.

>>For my backups in ancient DBISAM3, I do a StartTransaction, zip up the
>>tables (VCLZip) and then do a Rollback - can I do the same in ElevateDB?
>
> Why not just use BACKUP? >
That was my intention (also using replication to the muthical cloud)
However you have solved the problem - I had missed the vital lines in your
manual quote below.

> When the backup executes, it obtains a read lock for the entire database
> that prevents any sessions from
> performing any writes to any of the tables in the database until the
> backup completes.
>
> I read that as you don't need exclusive access (never tested it though) so
> could be handy for you. No need to kick people off.

Yippee!  Problem gone away - which is much better than "problem solved"..

Thanks, Roy

Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

Thu, Mar 27 2014 6:19 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff

>> I like that as a concept. However, in my file server apps everyone has to
>> log in (managed by an appusercount) and who is logged in is displayed on
>> the apps main page - no need to run round to much.
>
>That's more or less what I do, though it isn't as prominently displayed as
>yours. BUT the problem is the non log off people who just turn their
>machine off and go home. They are still showing as logged on and there
>isn't an easy way of knowing if they are really gone - specially a pain if
>they are VPN users miles away.

That's why I use the super component written by Terry Swires, I can't remember if its in binaries or extensions. Essentially it uses LockCurrentRecord and UnlockCurrentRecord to control things. These are similar to DBISAM's semaphore locks and when the process closes the lock is gone (haven't tried just turning machine off yet but will do and let you know). In theory they should always reflect the actual status of people being logged in.

Roy
Thu, Mar 27 2014 3:47 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Thanks for the info, Roy

Hopefully, when my migration to fully C/S ElevateDB is complete I can leave
this problem behind me.   Bye bye DBISAM3  - it HAS been nice knowing you
Wink

Cheers

Jeff
--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

"Roy Lambert" <roy@lybster.me.uk> wrote in message
news:1C928A06-D1E1-47E6-8F5D-1D0DEFBA9A14@news.elevatesoft.com...
> Jeff
>
>>> I like that as a concept. However, in my file server apps everyone has
>>> to
>>> log in (managed by an appusercount) and who is logged in is displayed on
>>> the apps main page - no need to run round to much.
>>
>>That's more or less what I do, though it isn't as prominently displayed as
>>yours. BUT the problem is the non log off people who just turn their
>>machine off and go home. They are still showing as logged on and there
>>isn't an easy way of knowing if they are really gone - specially a pain if
>>they are VPN users miles away.
>
> That's why I use the super component written by Terry Swires, I can't
> remember if its in binaries or extensions. Essentially it uses
> LockCurrentRecord and UnlockCurrentRecord to control things. These are
> similar to DBISAM's semaphore locks and when the process closes the lock
> is gone (haven't tried just turning machine off yet but will do and let
> you know). In theory they should always reflect the actual status of
> people being logged in.
>
> Roy

Image