Class Db2Connection

  • All Implemented Interfaces:
    AutoCloseable

    public class Db2Connection
    extends io.debezium.jdbc.JdbcConnection
    JdbcConnection extension to be used with IBM Db2
    Author:
    Horia Chiorean (hchiorea@redhat.com), Jiri Pechanec, Peter Urbanetz
    • Constructor Detail

      • Db2Connection

        public Db2Connection​(io.debezium.config.Configuration config)
        Creates a new connection using the supplied configuration.
        Parameters:
        config - Configuration instance, may not be null.
    • Method Detail

      • getChangesForTable

        public void getChangesForTable​(io.debezium.relational.TableId tableId,
                                       Lsn fromLsn,
                                       Lsn toLsn,
                                       io.debezium.jdbc.JdbcConnection.ResultSetConsumer consumer)
                                throws SQLException
        Provides all changes recorded by the DB2 CDC capture process for a given table.
        Parameters:
        tableId - - the requested table changes
        fromLsn - - closed lower bound of interval of changes to be provided
        toLsn - - closed upper bound of interval of changes to be provided
        consumer - - the change processor
        Throws:
        SQLException
      • getChangesForTables

        public void getChangesForTables​(Db2ChangeTable[] changeTables,
                                        Lsn intervalFromLsn,
                                        Lsn intervalToLsn,
                                        io.debezium.jdbc.JdbcConnection.BlockingMultiResultSetConsumer consumer)
                                 throws SQLException,
                                        InterruptedException
        Provides all changes recorder by the DB2 CDC capture process for a set of tables.
        Parameters:
        changeTables - - the requested tables to obtain changes for
        intervalFromLsn - - closed lower bound of interval of changes to be provided
        intervalToLsn - - closed upper bound of interval of changes to be provided
        consumer - - the change processor
        Throws:
        SQLException
        InterruptedException
      • incrementLsn

        public Lsn incrementLsn​(Lsn lsn)
                         throws SQLException
        Obtain the next available position in the database log.
        Parameters:
        lsn - - LSN of the current position
        Returns:
        LSN of the next position in the database
        Throws:
        SQLException
      • timestampOfLsn

        public Instant timestampOfLsn​(Lsn lsn)
                               throws SQLException
        Map a commit LSN to a point in time when the commit happened.
        Parameters:
        lsn - - LSN of the commit
        Returns:
        time when the commit was recorded into the database log
        Throws:
        SQLException
      • lockTable

        public void lockTable​(io.debezium.relational.TableId tableId)
                       throws SQLException
        Creates an exclusive lock for a given table.
        Parameters:
        tableId - to be locked
        Throws:
        SQLException
      • cdcNameForTable

        private String cdcNameForTable​(io.debezium.relational.TableId tableId)
      • getNameOfChangeTable

        public String getNameOfChangeTable​(String captureName)
      • getRealDatabaseName

        public String getRealDatabaseName()
      • isTableUniqueIndexIncluded

        protected boolean isTableUniqueIndexIncluded​(String indexName,
                                                     String columnName)
        Overrides:
        isTableUniqueIndexIncluded in class io.debezium.jdbc.JdbcConnection
      • retrieveRealDatabaseName

        private String retrieveRealDatabaseName()
      • connectionString

        public String connectionString()
        Returns a JDBC connection string for the current configuration.
        Returns:
        a String where the variables in urlPattern are replaced with values from the configuration
      • quotedTableIdString

        public String quotedTableIdString​(io.debezium.relational.TableId tableId)
        Overrides:
        quotedTableIdString in class io.debezium.jdbc.JdbcConnection