Hello,
What is the best method to keep a count of users logged into your application, handling things like the user crashing out and still keeping count etc, then locking people logging in based on that count.
Thanks
Hello,
What is the best method to keep a count of users logged into your application, handling things like the user crashing out and still keeping count etc, then locking people logging in based on that count.
Thanks
We add the application name to the database envionment details after connection. This allows us to select a count of active connections and use that to control user licensing.
Trying to manage counts in the database or something similar is problemmatic as you say when a program crashes out. In addition to the count in the DB you could create a file in the local user temp and delete it when the app closes. When the app opens you check for this file and that tells you they crashed out so you can ignore their new connection from a count poit of view. I would also reset the count for each working day to be sure.
Hope that helps
David
Yes, use SQL Anywhere 16 at the moment, we have an always opened connection
sqlca.DBMS = "ODBC"
CONNECT using sqlca;
Open throughout the application until close.
Should we DISCONNECT using sqlca; after we make SELECT/UPDATE etc or is it fine to just keep the connection open throughout, and is that required to be able to then count the users.
Depending on your database you should be able to form a query that is a variation on the sp_who stored procedure. Set the AppName in the DBParm and then use that in the where clause.
it depends on how you connect to your database, and what your database is.
If you only use a single connection in your application per exe, and set an application id along with your connection, then you can utilize your database's information to see how many logins are currently connected.