SQL database discovery
Database integration is used when there is a single, centralized database to be accessed. Database discovery, on the other hand, is used to perform queries on databases that have been discovered running on discovery targets. It is analogous to running commands on discovered hosts. SQL discovery is specified with
sql_discovery definitions. The
definitions block must contain a
group setting, which corresponds to a Database Credential in the user interface.
sql_integration definitions, the
define blocks in
sql_discovery ones require a
query setting, which gives the SQL query to be used.
When calling an
sql_discovery function, the target for the discovery must be specified via additional parameters. The functions take an
endpoint parameter, which is a Host node or DDD node that identifies the target (like the
target in built-in Discovery functions). Some database types require additional parameters to identify the target database, and most have a number of optional parameters. See the Driver Documentation for details. Additionally, databases might be listening only an a specific interface. The default behavior when a Host or DDD node is passed in the
endpoint parameter is to attempt the connection on the IP currently used for discovery. If this is not the specific interface that the database is listening on, this connection will fail. To avoid this an additional
address parameter can be passed. This should contain a string with the desired IP address, if this address is one of the current interfaces on the Host this will be used instead of the default behavior.
Here is a code snippet making a call into MySQL