Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many users SQL*Server/Oracle.
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00201227
Message ID:
00201248
Views:
11
I've come up with a solution that works for SQL Server, but I don't think it will work for Oracle. First, I have a table of users in SQL Server. Each user must have a SQL Server login that has the same username as the name in the user table. I also have an additional table with one record. This table has the number of users allowed and a code calculated from that number using a formula unkown to the user. When the user logs in I do the following:

1. Apply the 'secret formula' to the number of legal users and make sure it matches the code and that that's how many users there are in the user table.

2. I log the user in to SQL Server using a connection string. The connection string includes APP=MyAppName (more on that later).

3. I send the following to SQL Server using SQLEXEC():

SELECT COUNT(DISTINCT HostName) AS UserCount ;
FROM master.dbo.syslogins logins,master.dbo.sysprocesses procs ;
WHERE logins.SuID=procs.SuID AND procs.Program_Name='MyAppName' ;
AND logins.Name='username'
OK, so what the hell does all this do, you ask? Basically it tells me how many computers have logged on to SQL Server using the current user's login name. I expect the answer to be 1, because the user just logged in. I count the distinct host names because if the user has crashed he or she may still have a SQL Server connection that hasn't been cleared. Has long as the user is still using the same computer he or she crashed, you won't get 2 in the UserCount column. The reason I pass the app name in the connection string and then check for it in the SELECT is that I don't want to prevent the user from logging in to SQL Server on multiple machines at once, I just want to keep him or her from logging in to SQL Server using MY application more than once.

I won't go into all system tables involved in the queries. You can probably just check the SQL Server docs or experiment a bit to figure that out.

Hope this helps.

Josh

>I develop apps that use a 5-user, 10-user, etc. concurrent licensing approach. I use a vfp login table with each user 'locking' a record to gain access to a particular module. This works well in VFP, but with client server, I am concerned about WAN performance if users have to use a VFP table on a remote server. Has anyone else come up with concurrent licensing schemes for C/S apps.
>
>Thanks,
>
>Kevin
Previous
Reply
Map
View

Click here to load this message in the networking platform