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

debezium-connector-jdbc occurred java.sql.SQLException: ORA-01461: can bind a LONG value only

XMLWordPrintable

      Debezium connector version:

      database: oracle 12c(Non- CDB mode)
      kafka-connect: 3.5.1
      source connector: debezium-connector-oracle v2.2.1.Final
      sink connector: debezium-connector-jdbc v2.2.1.Final

      Debezium Jdbc connector configuration:

      ```

      "connector.class": "io.debezium.connector.jdbc.JdbcSinkConnector",
      "tasks.max": "1",
      "connection.url": "jdbc:oracle:thin:@192.168.1.77:1521:helowin",
      "connection.username": "etl_cdc",
      "connection.password": "*******",
      "table.name.format": "${topic}",
      "insert.mode": "upsert",
      "delete.enabled": "true",
      "topics": "T_ETL_EVENT_HTTP,T_ETL_EVENT_MODEL",
      "primary.key.mode": "record_key",
      "schema.evolution": "none",
      "database.time_zone": "UTC"

      ```

      Debezium Oracle connector configuration:

      ```

      "connector.class": "io.debezium.connector.oracle.OracleConnector",
      "decimal.handling.mode": "string",
      "log.mining.strategy": "online_catalog",
      "snapshot.mode": "schema_only",
      "database.serverTimezone": "UTC",
      "database.hostname": "192.168.1.101",
      "database.port": "1521",
      "database.user": "dbzuser",
      "database.password": "dbz",
      "database.dbname": "MHI",
      "schema.include.list": "etl",
      "lob.enabled": true,
      "column.propagate.source.type": "etl.T_ETL_EVENT_HTTP.JOB_LOG,etl.T_ETL_EVENT_MODEL.EXEC_LOG",
      "tasks.max": "1",
      "topic.prefix": "dev",
      "schema.history.internal.kafka.bootstrap.servers": "192.168.1.60:9092",
      "schema.history.internal.kafka.topic": "schema-changes.dev-etl",
      "transforms": "Reroute",
      "transforms.Reroute.type": "io.debezium.transforms.ByLogicalTableRouter",
      "transforms.Reroute.topic.regex": "^(.)\\.(.)
      .(.*)$",
      "transforms.Reroute.topic.replacement": "$3",
      "transforms.Reroute.key.enforce.uniqueness": false,
      "schema.history.internal.store.only.captured.tables.ddl": true,
      "event.processing.failure.handling.mode": "warn"

      ```

       

      There are two CLOB fields in source database  , the source connector setting `"lob.enabled": true` and `column.propagate.source.type`  parameter, because the CLOB field's length exceeds 4000, When the sink connector execute the 'merge info' SQL, an error occurred: java.sql.SQLException: ORA-01461: can bind a LONG value only.

       

      Chris Cranford (Naros) judged it is a bug , and needs to fix it by doing two critical things in the ConnectStringType implementation:

      If we see the incoming data type is CLOB for the source type, we should ask the dialect to use the CLOB-specific data type. Right now it explicitly only checks for CHAR and [N]VARCHAR[2] scenarios.
      If we detect the destination column is CLOB and the incoming type is ConnectStringType, we should construct a JDBC Clob object and insert the string data as a CLOB rather than it being treated as basic text.
      So unfortunately at this time, there is no workaround unless the text is short enough to fit into a VARCHAR2(4000) column. As for the size you see, that's expected because Oracle's JDBC metadata only ever returns CLOB with a max size of 4000, but that is ignored by Debezium and Oracle, it's just there to satisfy JDBC specifications.

       

              ccranfor@redhat.com Chris Cranford
              liangxueming liang xueming (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: