SQL database integration
Centralized databases — asset databases, for example — are accessed with
sql_integration definitions. The
definitions block must contain a
name setting.This setting corresponds to the Integration Point in the user interface. Each
define block must contain a
query setting that contains the SQL query to perform. Parameters are inserted into the query with the usual TPL
% interpolation. For example:
The defined function is used in a pattern as the function
AssetDatabaseDetails.getLocationOfHost. It is called with a
hostname parameter, followed by a
connection parameter. This parameter refers to a connection created within the Integration Point. It returns a list of nodes, one for each row of output from the query. If the query fails in some way, the function returns
none. Each row node has attributes named after the columns selected in the SQL query.
As some databases put all column names in uppercase or lowercase, BMC Discovery standardizes all result column names to lowercase.
For example, to use the query defined above, use the following code: