Class DB2LUWServerSurveyActionService

All Implemented Interfaces:
AuditLoggingComponent, SecureConnectorExtension, VirtualConnectorExtension, SurveyActionService

public class DB2LUWServerSurveyActionService extends SurveyActionServiceConnector
DB2LUWServerSurveyActionService surveys the databases hosted by a Db2 for Linux, UNIX and Windows server.

Unlike PostgreSQL (whose pg_database catalog view lists every database on the server from a single connection) and Oracle (whose CDB root can see every pluggable database through v$pdbs), Db2 for Linux, UNIX and Windows has no catalog view that spans multiple databases - each database maintains its own independent SYSCAT schema, and the list of databases known to an instance lives only in the server's local database directory, which is not queryable over JDBC. Consequently, the set of databases to survey cannot be auto-discovered: it is either just the single database the asset's connection already names, or - if the caller has supplied one - the includeDatabaseList configuration property naming every database that should be surveyed. excludeDatabaseList still applies as a filter on top of whichever list is used.

Db2 has no cheap way to tell, before connecting, whether the survey's userId holds the CONNECT privilege on a database (that is recorded in each database's own SYSCAT.DBAUTH), so an inaccessible database is detected when the connection to it fails, and is reported with the DATABASE_NOT_SURVEYED audit code.
  • Constructor Details

    • DB2LUWServerSurveyActionService

      public DB2LUWServerSurveyActionService()
  • Method Details

    • start

      Indicates that the survey action service is completely configured and can begin processing.

      The survey is broken into short units of work so that it does not hold a database transaction open for its whole duration: every query runs in auto-commit mode, and each database is visited through its own connection, which is released before the next database starts. Every database is visited twice: first to gather its database statistics (PROFILING_ASSOCIATED_RESOURCES) and then, unless the survey stops after that step, to survey its schemas (PRODUCE_INVENTORY). A database that cannot be surveyed is logged and skipped, and the annotations for each database are stored as soon as that database is complete, so a problem late in a large survey does not discard the work done before it.
      Overrides:
      start in class SurveyActionServiceConnector
      Throws:
      ConnectorCheckedException - a problem within the discovery service.
      UserNotAuthorizedException - the connector was disconnected before/during start
    • disconnect

      public void disconnect() throws ConnectorCheckedException
      Free up any resources held since the connector is no longer needed.
      Overrides:
      disconnect in class SurveyActionServiceConnector
      Throws:
      ConnectorCheckedException - the connector detected a problem.