Monday, March 28, 2011

Limiting Users for a Database

Advantage counts users based on the machine name that is connecting. This means that a single machine can have multiple connections to Advantage while only consuming a single license.  There are times when you may wish to limit the number of users to a particular database. For example you may be hosting data for multiple customers at your site or in the cloud. You may need a way to limit each customer to a specific number of concurrent users. If each customer has a specific database you can accomplish this by using the sp_mgGetTableUsers system procedure when your application starts up.

The sp_mgGetTableUsers procedure takes one parameter which is the full qualified path to the table. You can provide a path to a data dictionary instead of a table to get a list of all the users connected to the database. See the example below


As you can see this list returns all connections to the specified file. You will need to count the results based on the type of users you wish to track. If you are using a traditional client/server solution where each user has their own machine name ( as shown in the example ) you need to count the number of unique UserName values. If you are hosting the application on a terminal server then you will need to count the unique TSAddress values.

If you are using Advantage version 10 or newer you can use SQL to count the connections. The example below demonstrates different types of counts.


By running a script like the one above when your application starts you can get an accurate count of the total number of users connected to the specified database. You could then compare this to the number of licenses for that database. The number of licenses could be stored encrypted in the registry, in a license file or some other method.

There are a few limitations to this approach. This technique will not prevent third party applications since the check is done by your application and not by the server. This technique will also not work for a web based application since all users will be connecting through one or more web servers.

Monday, March 14, 2011

Advantage Training

The next Advantage Technical Summit has been scheduled for 18 – 20 May at the Bridgewater Mariott in New Jersey. The training will be co-located with the Sybase LPGA Match Play Championship which is held at the Hamilton Farm Golf Club. Attendees will get a wealth of information about Advantage and have an opportunity to attend the golf tournament as well.

You can get all the details here. The schedule overview is below and you can get details about all of the sessions using this link.

Wednesday, May 18th:
2pm – 5:00pm: Sessions
5:30pm – Hosted Dinner at Hamilton Golf Club with LPGA professionals

Thursday, May 19th:
8am – 2:30: Sessions
2:30 – 5:00: Sybase Match Play Championship Event
6:30 – Hosted Dinner and networking event

Friday, May 20th:
8am – Noon: Sessions
Noon – 1:30pm: Hosted Lunch at Hamilton Golf Club
1:30 – 5:00: Sybase Match Play Championship Event

I look forward to seeing you there.

Wednesday, March 2, 2011

Advantage in the Real World

Cary Jensen wrote an article about how he has been using Advantage with one of his customers. He focuses on several server-side features including replication, triggers and notifications. It provides some examples on how these features can be used to enhance an existing application. You can read the article here.