With QLM Enterprise, you can implement floating licenses using one of several methods. The basic principle behind the 3 methods presented below is a central database located on the customer network that each client connects to in order to check out a license and then check it back in.
- For small installation of less than 30 concurrent nodes, the central database is implemented as an XML file located on a network share at your customer's site. This solution does not require any special deployment.
- For medium size installations of 30-100 concurrent nodes, the central database is implemented as a MS-Access database located on a network share at your customer's site. This solution may require installation of MS-Access drivers on each client node.
- For larger installations of 100+ concurrent nodes, the central database is implemented as a MS SQL Server database located on the customer's network. This solution requires a MS SQL Server at the customer site. All editions of MS-SQL Server are supported including the free SQL Server Express edition.
This article walks you through the steps required to add floating licensing to your application using a SQL Server database. The article is based on the following sample which supports an Xml, a MS-Access or a SQL Server database: C:\Users\Public\Documents\Quick License Manager\Samples\qlmenterprise\DotNet\C#\QlmFloatingLicenseSample (formerly called QlmEnterpriseSample)
Creation of the database
To create the floating license SQL Server database, simply execute the sql.floatingdb.createdb.sql script located in the Db folder. In the script, you may want to update the path of the database to a location of your choice. A SQL Server login user called "qlmfloating_user" is automatically created by the sql script above. The password of the "qlmfloating_user" user can be configured in the Protect Your Application wizard (3rd tab in the QLM Management Console) by setting the QlmFloatingDbPassword property. You should also set the QlmFloatingLicenseDbFormat property to the desired value.
The first step in implementing floating licensing is to initialize the QLM Floating database. The simplest way to initialize the database is by using the QLM License Wizard. By launching the QlmLicenseWizard.exe with the /floating_master argument, a new page is added to the wizard that allows the user to specify the location of the database. For XML and MS-Access, the user is required to specify a UNC path to the QLM Floating database. For MS SQL Server, the user must specify the SQL Server as well as the name of the database in the following format: Data Source=SERVER;Initial Catalog=QLMFLOATINGDB. Example: Data Source=SQL-SERVER;Initial Catalog=qlmFloating.
When your application is launched, call QlmLicense.ReadFloatingLicenseLocation to determine if the QLM Floating License Database was already registered on this system. If the location is empty, prompt the user to specify the location of the database. Once again, you can use the QLM License Wizard to prompt the user to enter the location of the database by using the /floating_node argument.
Once the location of the database is set, you should perform the following:
- Call ValidateLicenseLocation to ensure the location of the database is correct. This is to prevent users from duplicating the floating license database. Note that this call requires internet access as it validates the location with the license server.
- Call ActivateFloatingLicense to register the current node
When your application exits, call ReleaseFloatingLicense to unregister this node.
Note that if a registered node is manually removed from the database, the node will be automatically re-registered within 30 seconds. The EnableAutomaticRegistration property controls this behavior. In the event all licenses have been consumed, a QlmFloatingLicenseViolationEvent will be fired. You can take the appropriate action when this event is fired, such as exiting the application.
Users can check-out a license to work offline. To check-out a license for offline usage, you call the SetOfflineMode method. You can configure the maximum period of time a license can be used offline by setting the FloatingLicenseMaxOfflineDuration property. This property can be set in code or can be set in the Protect Your Application wizard and is stored in the settings XML file generated by that wizard.
Floating License Viewer
The QLMFloatingLicenseViewer.exe is a standalone application that you can redistribute with your product to enable your customers to view their running nodes with the ability to release nodes that may have crashed.
The licence wizard can release licenses of all nodes except offline nodes that have not expired. For example, if you have set the FloatingLicenseMaxOfflineDuration to 12 hours, a node that is working offline can only be released by the Floating License Viewer 12 hours after it has gone offline.