Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-9536

Postgres connector should use Connection.unwrap instead of casting, when working with connections

XMLWordPrintable

      What Debezium connector do you use and what version?

      2.6.2-Final

      Feature request or enhancement

      The Postgres Debezium connector allows the use of a custom connection factory that must implement the io.debezium.jdbc.JdbcConnection.ConnectionFactory interface. This interface contains a single method with the signature: Connection connect(JdbcConfiguration config) throws SQLException. Therefore, the custom factory should return a java.sql.Connection object.

      However, within its internal code, the Debezium Postgres connector casts this connection to either org.postgresql.jdbc.BaseConnection or, more problematically, to org.postgresql.jdbc.PgConnection. This casting behavior, particularly to PgConnection, prevents the use of a custom connection wrapper in the connection factory, as PgConnection has only one public constructor, which immediately establishes a connection to Postgres. You can review this behavior in the connector's GitHub repository (github link).

      Which use case/requirement will be addressed by the proposed feature?

      Using custom connection factory

      Implementation ideas (optional)

      io.debezium.connector.postgresql.connection.PostrgesConnection should rather call Connection.unwrap(<target class>). 
       

              Unassigned Unassigned
              tantoglow Georgii Bocharov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: