Tuesday, January 27, 2009

Tip #37 – Using ApplicationID with SQL

The ApplicationId property was added to Advantage in version 8.0. This property allows developers to specify an ID for their application when connecting to Advantage. By default this property is set to the name of the executable which is connecting (i.e. ARC.exe).

This property can be set and read using SQL statements. To set the ApplicationID use the sp_SetApplicationID system procedure. The ID can be retrieved using the sp_GetApplicationID system procedure or using the ApplicationID() SQL scalar function. See the examples below:

// Set the ApplicationID to Chris
EXECUTE PROCEDURE sp_SetApplicationID('Chris')
// Retrieve the ApplicationID
// Using the ApplicationID SQL Scalar Function

The ApplicationID will also be reported by the remote management utility in ARC. You can also get management information with SQL statements see Management via SQL. The ApplicationID is displayed on the connected users tab.

ARC Management Utility


Anonymous said...

Chris...can you give an example or two of how the ApplicationID could be put to good use? How are other users using this value?

Anonymous said...

Why is it that when in ARC, I can't see this column (Application ID). The last one I see is Terminal Client Address ( using ). Is it a setting somewhere? Lynne

Chris said...

The ApplicationID can be very useful if you are logging activity in your database. It can assist in identifying which applications are modifying data in the tables.

The ApplicationID was added to the ADS_MGMT_USER_INFO structure in version 9.0 of Advantage so it is not available from the 8.x management functions. You can still use sp_GetApplicationID or the ApplicationID scalar function with version 8.x