IBM Db2 Source (JDBC) Connector for Confluent Cloud
The fully-managed IBM Db2 Source connector for Confluent Cloud reads data from an IBM Db2 database and writes records to Apache Kafka® topics. The connector can obtain a snapshot of existing data and then monitor and record all subsequent row-level changes. The connector supports Avro, JSON Schema, Protobuf, or JSON (schemaless) output data formats. All of the events for each table are recorded in a separate Kafka topic. Note that deleted records are not captured.
This Quick Start is for the fully-managed Confluent Cloud connector. If you are installing the connector locally for Confluent Platform, see JDBC Connector (Source and Sink) for Confluent Platform.
If you require private networking for fully-managed connectors, make sure to set up the proper networking beforehand. For more information, see Manage Networking for Confluent Cloud Connectors.
Features
The IBM Db2 Source connector provides the following features:
At least once delivery: The connector guarantees that records are delivered at least once to the Kafka topic.
Topics created automatically: The connector automatically creates Kafka topics using the naming convention:
<topic.prefix><tableName>. The tables are created with the properties:topic.creation.default.partitions=1andtopic.creation.default.replication.factor=3.Insert modes:
timestampmode is enabled when only a timestamp column is specified when you enter database details.timestamp+incrementingmode is enabled when both a timestamp column and incrementing column are specified when you enter database details.Important
A timestamp column must not be nullable.
Record processing: Supports table and query modes. Use the
queryproperty to execute custom SQL queries for joining tables or selecting specific data subsets.SSL support: Supports one-way SSL.
Client-side encryption (CSFLE) support: The connector supports Client-Side Field Level Encryption (CSFLE) for sensitive data. For more information about CSFLE setup, see the connector configuration.
Data format with or without a schema: The connector supports Avro, JSON Schema, Protobuf, JSON (schemaless), or Bytes. Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf). See Schema Registry Enabled Environments for additional information.
Select configuration properties:
db.timezonepoll.interval.msbatch.max.rowstimestamp.delay.interval.mstopic.prefixschema.pattern
Offset management capabilities: Supports offset management. For more information, see Manage custom offsets.
For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.
Limitations
For connector limitations, see IBM Db2 Source JDBC Connector.
Manage custom offsets
You can manage the offsets for this connector. Offsets provide information on the point in the system from which the connector is accessing data. For more information, see Manage Offsets for Fully-Managed Connectors in Confluent Cloud.
To manage offsets:
Manage offsets using Confluent Cloud APIs. For more information, see Connect offsets API reference.
To get the current offset, make a GET request that specifies the environment, Kafka cluster, and connector name.
GET /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets
Host: https://api.confluent.cloud
Response:
Successful calls return HTTP 200 with a JSON payload that describes the offset.
{
"id": "lcc-example123",
"name": "{connector_name}",
"offsets": [
{
"partition": {
"protocol": "1",
"table": "{table_name}"
},
"offset": {
"incrementing": 26
}
}
],
"metadata": {
"observed_at": "2024-03-28T17:57:48.139635200Z"
}
}
Responses include the following information:
The position of latest offset.
The observed time of the offset in the metadata portion of the payload. The
observed_attime indicates a snapshot in time for when the API retrieved the offset. A running connector is always updating its offsets. Useobserved_atto get a sense for the gap between real time and the time at which the request was made. By default, offsets are observed every minute. CallingGETrepeatedly will fetch more recently observed offsets.Information about the connector.
In these examples, the curly braces around “{connector_name}” indicate a replaceable value.
To update the offset, make a POST request that specifies the environment, Kafka cluster, and connector name. Include a JSON payload that specifies new offset and a patch type.
POST /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request
Host: https://api.confluent.cloud
{
"type": "PATCH",
"offsets": [
{
"partition": {
"protocol": "1",
"table": "{table_name}"
},
"offset": {
"incrementing": 3
}
}
]
}
Considerations:
You can only make one offset change at a time for a given connector.
This is an asynchronous request. To check the status of this request, you must use the check offset status API. For more information, see Get the status of an offset request.
For source connectors, the connector attempts to read from the position defined by the requested offsets.
Response:
Successful calls return HTTP 202 Accepted with a JSON payload that describes the offset.
{
"id": "lcc-example123",
"name": "{connector_name}",
"offsets": [
{
"partition": {
"protocol": "1",
"table": "{table_name}"
},
"offset": {
"incrementing": 3
}
}
],
"requested_at": "2024-03-28T17:58:45.606796307Z",
"type": "PATCH"
}
Responses include the following information:
The requested position of the offsets in the source.
The time of the request to update the offset.
Information about the connector.
To delete the offset, make a POST request that specifies the environment, Kafka cluster, and connector name. Include a JSON payload that specifies the delete type.
POST /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request
Host: https://api.confluent.cloud
{
"type": "DELETE"
}
Considerations:
Delete requests delete the offset for the provided partition and reset to the base state. A delete request is as if you created a fresh new connector.
This is an asynchronous request. To check the status of this request, you must use the check offset status API. For more information, see Get the status of an offset request.
Do not issue delete and patch requests at the same time.
For source connectors, the connector attempts to read from the position defined in the base state.
Response:
Successful calls return HTTP 202 Accepted with a JSON payload that describes the result.
{
"id": "lcc-example123",
"name": "{connector_name}",
"offsets": [],
"requested_at": "2024-03-28T17:59:45.606796307Z",
"type": "DELETE"
}
Responses include the following information:
Empty offsets.
The time of the request to delete the offset.
Information about Kafka cluster and connector.
The type of request.
To get the status of a previous offset request, make a GET request that specifies the environment, Kafka cluster, and connector name.
GET /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request/status
Host: https://api.confluent.cloud
Considerations:
The status endpoint always shows the status of the most recent PATCH/DELETE operation.
Response:
Successful calls return HTTP 200 with a JSON payload that describes the result. The following is an example of an applied patch.
{
"request": {
"id": "lcc-example123",
"name": "{connector_name}",
"offsets": [
{
"partition": {
"protocol": "1",
"table": "{table_name}"
},
"offset": {
"incrementing": 3
}
}
],
"requested_at": "2024-03-28T17:58:45.606796307Z",
"type": "PATCH"
},
"status": {
"phase": "APPLIED",
"message": "The Connect framework-managed offsets for this connector have been altered successfully. However, if this connector manages offsets externally, they will need to be manually altered in the system that the connector uses."
},
"previous_offsets": [
{
"partition": {
"protocol": "1",
"table": "{table_name}"
},
"offset": {
"incrementing": 26
}
}
],
"applied_at": "2024-03-28T17:58:48.079141883Z"
}
Responses include the following information:
The original request, including the time it was made.
The status of the request: applied, pending, or failed.
The time you issued the status request.
The previous offsets. These are the offsets that the connector last updated prior to updating the offsets. Use these to try to restore the state of your connector if a patch update causes your connector to fail or to return a connector to its previous state after rolling back.
JDBC modes and offsets
You can run the JDBC source connectors in one of four modes. Each mode uses a different offset object in its JSON payload to track the progress of the connector. The provided samples show an offset object from a JBDC source connector in incrementing mode.
bulk- No offset. This is the default mode for JDBC source connectors.incrementing- The offset is provided by theincrementingproperty in the offset object.timestamp- The offset is provided by thetimestampandtimestamp-nanosproperties in the offset object.timestamp+incrementing- The offset is provided by theincrementing,timestampandtimestamp-nanosproperties in the offset object.
JSON payload
The table below offers a description of the unique fields in the JSON payload for managing offsets of the JDBC Source connectors, including:
IBM Db2 Source connector
Microsoft SQL Server Source connector
MySQL Source connector
Oracle Database Source connector
PostgreSQL Source connector
Field | Definition | Required/Optional |
|---|---|---|
| Specifies the value of Available only in the following modes: incrementing, timestamp+incrementing. | Required |
| Specifies the protocol. Available in the following modes: incrementing, timestamp, timestamp+incrementing. | Required |
| The name of the table. Available in the following modes: incrementing, timestamp, timestamp+incrementing. | Required |
| The number of milliseconds since Available only in the following modes: timestamp, timestamp+incrementing. | Required |
| Fractional seconds component of the timestamp object. Available only in the following modes: timestamp, timestamp+incrementing. | Required |
Quick start
Use this quick start to get up and running with the Confluent Cloud IBM Db2 Source connector. The quick start provides the basics of selecting the connector and configuring it to read data from an IBM Db2 database and writing records to Kafka topics.
- Prerequisites
Authorized access to a Confluent Cloud cluster on Amazon Web Services (AWS), Microsoft Azure (Azure), or Google Cloud.
The Confluent CLI installed and configured for the cluster. See Install the Confluent CLI.
An IBM Db2 for Linux, UNIX, and Windows (LUW) database. The connector supports only LUW-based IBM Db2 databases.
The connector automatically creates Kafka topics using the naming convention:
<topic.prefix><tableName>. The tables are created with the properties:topic.creation.default.partitions=1andtopic.creation.default.replication.factor=3. If you want to create topics with specific settings, create the topics before running this connector.Important
If you are configuring granular access using a service account, and you leave the optional Topic prefix (
topic.prefix) configuration property empty, you must grant ACLCREATEandWRITEaccess to all the Kafka topics or create RBAC role bindings. To add ACLs, you use the (*) wildcard in the ACL entries as shown in the following examples.confluent kafka acl create --allow --service-account "<service-account-id>" --operation create --topic "*"
confluent kafka acl create --allow --service-account "<service-account-id>" --operation write --topic "*"
Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf). See Schema Registry Enabled Environments for additional information.
Make sure your connector can reach your service. Consider the following before running the connector:
Depending on the service environment, certain network access limitations may exist. See Manage Networking for Confluent Cloud Connectors for details.
To use a set of public egress IP addresses, see Public Egress IP Addresses for Confluent Cloud Connectors. For additional fully-managed connector networking details, see Networking and DNS.
See your specific cloud platform documentation for how to configure security rules for your VPC.
Kafka cluster credentials. The following lists the different ways you can provide credentials.
Enter an existing service account resource ID.
Create a Confluent Cloud service account for the connector. Make sure to review the ACL entries required in the service account documentation. Some connectors have specific ACL requirements.
Create a Confluent Cloud API key and secret. To create a key and secret, you can use confluent api-key create or you can autogenerate the API key and secret directly in the Cloud Console when setting up the connector.
Using the Confluent Cloud Console
Step 1: Launch your Confluent Cloud cluster
To create and launch a Kafka cluster in Confluent Cloud, see Create a kafka cluster in Confluent Cloud.
Step 2: Add a connector
In the left navigation menu, click Connectors. If you already have connectors in your cluster, click + Add connector.
Step 3: Select your connector
Click the IBM Db2 Source connector card.

Step 4: Enter the connector details
Complete the following steps to configure and launch the connector.
Note
Make sure you have all your prerequisites completed.
An asterisk ( * ) designates a required entry.
At the IBM Db2 Source Connector screen, complete the following:
In the Topic prefix field, define a topic prefix your connector uses to publish to Kafka topics. The connector creates Kafka topics using the following naming convention: <topic.prefix><tableName>.
Important
If you are configuring granular access using a service account, and you leave the optional Topic prefix (topic.prefix) configuration property empty, you must grant ACL CREATE and WRITE access to all the Kafka topics or create RBAC role bindings. To add ACLs, you use the (*) wildcard in the ACL entries as shown in the following examples.
confluent kafka acl create --allow --service-account
"<service-account-id>" --operation create --topic "*"
confluent kafka acl create --allow --service-account
"<service-account-id>" --operation write --topic "*"
Select the way you want to provide Kafka Cluster credentials. You can choose one of the following options:
My account: This setting allows your connector to globally access everything that you have access to. With a user account, the connector uses an API key and secret to access the Kafka cluster. This option is not recommended for production.
Service account: This setting limits the access for your connector by using a service account. This option is recommended for production.
Use an existing API key: This setting allows you to specify an API key and a secret pair. You can use an existing pair or create a new one. This method is not recommended for production environments.
Note
Freight clusters support only service accounts for Kafka authentication.
Click Continue.
Configure the authentication properties:
Connection host: The host name or IP address of the database server. Depending on the service environment, certain network access limitations may exist. Make sure the connector can reach your service. Do not include
jdbc:xxxx://in the connection host property. For example,database-1.abc234ec2.us-west.rds.amazonaws.com.Connection port: The port number of the database server.
Connection user: The database user for the connection.
Connection password: The password for the database user.
Database name: The name of the database to connect to.
SSL mode: The SSL mode for connecting to the database.
preferallows the connection to be unencrypted andrequireencrypts the connection but does not perform certificate validation on the server.verify-caandverify-fullrequire you to provide a file containing the SSL CA certificate. The server certificate is verified as signed by one of these authorities.verify-caverifies that the server certificate is issued by a trusted CA.verify-fullverifies that the server certificate is issued by a trusted CA and that the server host name matches the name in the certificate. Client authentication is not performed.Trust store: The binary trust store file that contains the server CA certificate. Required only if you use
verify-caorverify-fullSSL mode. The connector supports files in JKS format. For REST API usage, you must base64-encode the binary trust store file and prefix it withdata:text/plain;base64,. For example, first encode the filebase64_truststore=$(cat /path/to/truststore.jks | base64)and then usedata:text/plain;base64,$base64_truststoreas the value.Trust store password: The trust store password for the file containing the server CA certificate. Required only if you use
verify-caorverify-fullSSL mode.
Click Continue.
Table types: By default, the connector detects only tables with type
TABLEfrom the source database. Use this property to specify a comma-separated list of table types to extract.Database timezone: The JDBC timezone name used in the connector when querying with time-based criteria. Defaults to
UTC.Table include list: A comma-separated list of regular expressions that match the fully-qualified names of tables to copy. Table names are case-sensitive. For example,
table.include.list: schema1.customer.*,schema2.order.*. If specified, you cannot settable.whitelist.Table exclude list: A comma-separated list of regular expressions that match the fully-qualified names of tables to exclude from copying. Table names are case-sensitive. For example,
table.exclude.list: schema1.customer.*,schema2.order.*. If specified, you cannot settable.whitelist.
Output messages
Select output record value format: Sets the output Kafka record value format. Valid entries are
AVRO,JSON_SR,PROTOBUF, orJSON.Note
You must have Confluent Cloud Schema Registry configured if using a schema-based message format like
AVRO,JSON_SR, orPROTOBUF.
Show advanced configurations
Schema context: Select a schema context to use for this connector, if using a schema-based data format. This property defaults to the Default context, which configures the connector to use the default schema set up for Schema Registry in your Confluent Cloud environment. A schema context allows you to use separate schemas (like schema sub-registries) tied to topics in different Kafka clusters that share the same Schema Registry environment. For example, if you select a non-default context, a Source connector uses only that schema context to register a schema and a Sink connector uses only that schema context to read from. For more information about setting up a schema context, see What are schema contexts and when should you use them?.
Mode: The mode for updating a table each time it is polled.
BULK: performs a bulk load of the entire table each time it is polled.TIMESTAMP: uses a timestamp (or timestamp-like) column to detect new and modified rows. This assumes the column is updated with each write, and that values are monotonically incrementing, but not necessarily unique.INCREMENTING: uses a strictly incrementing column on each table to detect only new rows. This does not detect modifications or deletions of existing rows.TIMESTAMP AND INCREMENTING: uses two columns, a timestamp column that detects new and modified rows and a strictly incrementing column which provides a globally unique ID for updates so each row can be assigned a unique stream offset.Table to timestamp columns mappings: A comma-separated list of table regex to timestamp column mappings. When you specify multiple timestamp columns, the connector uses the
COALESCESQL function to determine the effective timestamp for a row. Expected format isregex1:[col1|col2],regex2:[col3]. Regexes are matched against the fully-qualified table names. Identifier names are case-sensitive. Every table included for capture must match exactly one of the provided mappings. For example,.*\.customers.*:[updated_at|modified_at],.*\.orders.*:[changed_at].Numeric Mapping: Maps
NUMERICvalues by precision and optionally scale to integral or decimal types. Usenoneif allNUMERICcolumns are to be represented by the ConnectDECIMALlogical type. Usebest_fitifNUMERICcolumns should be cast to ConnectINT8,INT16,INT32,INT64, orFLOAT64based upon the column precision and scale. Usebest_fit_eager_doubleif, in addition to the properties ofbest_fit, you want to always castNUMERICcolumns with scale to ConnectFLOAT64type, despite potential loss in accuracy. Useprecision_onlyto mapNUMERICcolumns based only on the column precision assuming the column scale is0. Thenoneoption is the default, but may lead to serialization issues with Avro since the ConnectDECIMALtype is mapped to its binary representation, andbest_fitis often preferred since it maps to the most appropriate primitive type.Table to incrementing column mappings: A comma-separated list of table regex to incrementing column mappings. Expected format is
regex1:col1,regex2:col2. Regexes are matched against the fully-qualified table names. Identifier names are case-sensitive. Every table included for capture must match exactly one of the provided mappings. For example,.*\.customers.*:id,.*\.orders.*:order_id.Schema pattern: The schema pattern used to fetch table metadata from the database.
Quote SQL Identifiers: Determines when to quote table names, column names, and other identifiers in SQL statements. For backward compatibility, the default value is
ALWAYS.Timestamp column name (Deprecated): (Deprecated legacy configuration. Use
timestamp.columns.mappingfor new implementations.) A comma-separated list of one or more timestamp columns to detect new or modified rows using theCOALESCESQL function. Rows whose first non-null timestamp value is greater than the largest previous timestamp value seen are discovered with each poll. At least one column must not be nullable.Initial timestamp: The epoch timestamp used for initial queries that use timestamp criteria. The value
-1sets the initial timestamp to the current time. If not specified, the connector retrieves all data. After the connector records a source offset, this property has no effect even if changed to a different value later.Date Calendar System: The time elapsed from epoch populated in the end table topic for
DATEorTIMESTAMPtype columns can have two different values based upon the calendar used to interpret it. IfLEGACYis used, the connector uses the hybrid Gregorian/Julian calendar which was the default in older Java date time APIs. IfPROLEPTIC_GREGORIANis used, the connector uses the proleptic Gregorian calendar which extends the Gregorian rules backward indefinitely and does not apply the 1582 cutover. This matches the behavior of modern Java date/time APIs (java.time). The default isLEGACYfor backward compatibility.Warning
Changing this configuration on an existing connector may lead to a drift in Kafka topic record values.
Transaction Isolation Level: The isolation level determines how transaction integrity is visible to other users and systems.
DEFAULT: the default isolation level configured at the database server.READ_UNCOMMITTED: the lowest isolation level. At this level, one transaction may see dirty reads (that is, not-yet-committed changes made by other transactions).READ_COMMITTED: guarantees that any data read is already committed at the moment it is read.REPEATABLE_READ: in addition to the guarantees ofREAD_COMMITTED, also guarantees that any data read cannot change if the transaction reads the same data again. However, phantom reads are possible.SERIALIZABLE: the highest isolation level. In addition to everythingREPEATABLE_READguarantees, it also eliminates phantom reads.Timestamp granularity for timestamp columns: Defines the granularity of the timestamp column.
CONNECT_LOGICAL(default): represents timestamp values using Kafka Connect built-in representations.MICROS_LONG: represents timestamp values as microseconds since epoch.MICROS_STRING: represents timestamp values as microseconds since epoch in string.MICROS_ISO_DATETIME_STRING: uses ISO format for timestamps in microseconds.NANOS_LONG: represents timestamp values as nanoseconds since epoch.NANOS_STRING: represents timestamp values as nanoseconds since epoch in string.NANOS_ISO_DATETIME_STRING: uses ISO format for timestamps in nanoseconds.Poll interval (ms): Set the time in milliseconds to wait for new change events when no data is returned. Default is
500ms.Max rows per batch: The maximum number of rows to include in a single batch when polling for new data. Use this setting to limit the amount of data buffered internally in the connector.
Delay interval (ms): How long to wait after a row with a certain timestamp appears before including it in the result. You can add some delay to allow transactions with an earlier timestamp to complete. The first execution fetches all available records (starting at timestamp
0) until current time minus the delay. Every subsequent execution gets data from the last time fetched until current time minus the delay.
Additional Configs
Value Converter Replace Null With Default: Whether to replace fields that have a default value and that are null to the default value. When set to true, the default value is used, otherwise null is used. Applicable for JSON Converter.
Value Converter Reference Subject Name Strategy: Set the subject reference name strategy for value. Valid entries are DefaultReferenceSubjectNameStrategy or QualifiedReferenceSubjectNameStrategy. Note that the subject reference name strategy can be selected only for PROTOBUF format with the default strategy being DefaultReferenceSubjectNameStrategy.
Value Converter Schemas Enable: Include schemas within each of the serialized values. Input messages must contain schema and payload fields and may not contain additional fields. For plain JSON data, set this to false. Applicable for JSON Converter.
Errors Tolerance: Use this property if you would like to configure the connector’s error handling behavior. WARNING: This property should be used with CAUTION for SOURCE CONNECTORS as it may lead to dataloss. If you set this property to ‘all’, the connector will not fail on errant records, but will instead log them (and send to DLQ for Sink Connectors) and continue processing. If you set this property to ‘none’, the connector task will fail on errant records.
Value Converter Ignore Default For Nullables: When set to true, this property ensures that the corresponding record in Kafka is NULL, instead of showing the default column value. Applicable for AVRO,PROTOBUF and JSON_SR Converters.
Value Converter Decimal Format: Specify the JSON/JSON_SR serialization format for Connect DECIMAL logical type values with two allowed literals: BASE64 to serialize DECIMAL logical types as base64 encoded binary data and NUMERIC to serialize Connect DECIMAL logical type values in JSON/JSON_SR as a number representing the decimal value.
Key Converter Schema ID Serializer: The class name of the schema ID serializer for keys. This is used to serialize schema IDs in the message headers.
Value Converter Connect Meta Data: Allow the Connect converter to add its metadata to the output schema. Applicable for Avro Converters.
Value Converter Value Subject Name Strategy: Determines how to construct the subject name under which the value schema is registered with Schema Registry.
Key Converter Key Subject Name Strategy: How to construct the subject name for key schema registration.
Value Converter Schema ID Serializer: The class name of the schema ID serializer for values. This is used to serialize schema IDs in the message headers.
Auto-restart policy
Enable Connector Auto-restart: Control the auto-restart behavior of the connector and its task in the event of user-actionable errors. Defaults to
true, enabling the connector to automatically restart in case of user-actionable errors. Set this property tofalseto disable auto-restart for failed connectors. In such cases, you would need to manually restart the connector.
Database details
Query Config: If specified, the connector uses this custom SQL query to read source records, which allows for operations like joining tables or selecting subsets of data. Providing a query instructs the connector to read only the result set instead of performing a full table copy. This configuration supports different query modes with the incremental query properly constructed by appending a
WHEREclause. For more information, see Incremental Query Modes. OnlySELECTstatements are supported.Note
Always adhere to security best practices, like enforcing strict authorization through managed connector RBAC, applying appropriate network access controls for control plane APIs, and following the principle of least privilege when provisioning identities or credentials for any third-party systems.
Transforms
Single Message Transforms: To add a new SMT, see Add transforms. For more information about unsupported SMTs, see Unsupported transformations.
Data encryption
Enable Client-Side Field Level Encryption for data encryption. Specify a Service Account to access the Schema Registry and associated encryption rules or keys with that schema. For more information on CSFLE or CSPE setup, see Manage encryption for connectors.
Processing position
Set offsets: Click Set offsets to define a specific offset for this connector to begin procession data from. For more information on managing offsets, see Manage offsets.
For all property values and definitions, see Configuration properties.
Click Continue.
Based on the number of topic partitions you select, you are provided with a recommended number of tasks.
To change the number of tasks, use the Range Slider to select the desired number of tasks.
Click Continue.
Verify the connection details by previewing the running configuration.
After you validate that the properties are configured to your satisfaction, click Launch.
The status for the connector should go from Provisioning to Running.
Step 5: Check the Kafka topic
After the connector is running, verify that messages are populating your Kafka topic.
For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.
Using the Confluent CLI
Complete the following steps to set up and run the connector using the Confluent CLI.
Note
Make sure you have all your prerequisites completed.
Step 1: List the available connectors
Enter the following command to list available connectors:
confluent connect plugin list
Step 2: List the connector configuration properties
Enter the following command to show the connector configuration properties:
confluent connect plugin describe <connector-plugin-name>
The command output shows the required and optional configuration properties.
Step 3: Create the connector configuration file
Create a JSON file that contains the connector configuration properties. The following example shows the required connector properties.
{
"name" : "confluent-ibmdb2-source",
"connector.class": "IbmDb2Source",
"kafka.api.key": "<my-kafka-api-key>",
"kafka.auth.mode": "KAFKA_API_KEY",
"kafka.api.secret" : "<my-kafka-api-secret>",
"topic.prefix" : "ibmdb2_",
"ssl.mode" : "prefer",
"connection.host" : "<my-database-endpoint>",
"connection.port" : "50000",
"connection.user" : "<my-database-user>",
"connection.password": "<my-database-password>",
"db.name": "<my-database-name>",
"table.include.list": ".*<my_table>.*",
"timestamp.columns.mapping": ".*<my_table>.*:[created_at]",
"output.data.format": "JSON",
"db.timezone": "UTC",
"tasks.max" : "1"
}
Note the following property definitions:
"name": Sets a name for your new connector."connector.class": Identifies the connector plugin name.
"kafka.auth.mode": Identifies the connector authentication mode you want to use. There are two options:SERVICE_ACCOUNTorKAFKA_API_KEY(the default). To use an API key and secret, specify the configuration propertieskafka.api.keyandkafka.api.secret, as shown in the example configuration (above). To use a service account, specify the Resource ID in the propertykafka.service.account.id=<service-account-resource-ID>. To list the available service account resource IDs, use the following command:confluent iam service-account list
For example:
confluent iam service-account list Id | Resource ID | Name | Description +---------+-------------+-------------------+------------------- 123456 | sa-l1r23m | sa-1 | Service account 1 789101 | sa-l4d56p | sa-2 | Service account 2
"topic.prefix": Enter a topic prefix. The connector automatically creates Kafka topics using the naming convention:<topic.prefix><tableName>. The tables are created with the properties:topic.creation.default.partitions=1andtopic.creation.default.replication.factor=3. If you want to create topics with specific settings, create the topics before running this connector. If you are configuring granular access using a service account, you must set up ACLs for the topic prefix.Important
If you are configuring granular access using a service account, and you leave the optional Topic prefix (
topic.prefix) configuration property empty, you must grant ACLCREATEandWRITEaccess to all the Kafka topics or create RBAC role bindings. To add ACLs, you use the (*) wildcard in the ACL entries as shown in the following examples.confluent kafka acl create --allow --service-account "<service-account-id>" --operation create --topic "*"
confluent kafka acl create --allow --service-account "<service-account-id>" --operation write --topic "*"
The following provides more information about how to use the
ssl.modeproperty:The default option
preferis enabled ifssl.modeis not added to the connector configuration. Whenpreferis enabled, the connector attempts to use an encrypted connection to the database server.preferandrequire: use a secure (encrypted) connection. The connector fails if a secure connection cannot be established. These modes do not do Certification Authority (CA) validation.verify-ca: similar torequire, but also verifies the server TLS certificate against the configured Certificate Authority (CA) certificates. Fails if no valid matching CA certificates are found.verify-full: similar toverify-ca, but also verifies that the server certificate matches the host to which the connection is attempted.
If you choose
verify-caorverify-full, use the propertyssl.rootcertfileand add the contents of the text certificate file for the property value. For example,"ssl.rootcertfile": "<certificate-text>".The following provides more information about how to use the
timestamp.columns.mappingandincrementing.column.nameproperties.Enter a
timestamp.columns.mappingvalue to enable timestamp mode. This mode uses a timestamp (or timestamp-like) column to detect new and modified rows. This assumes the column is updated with each write, and that values are monotonically incrementing, but not necessarily unique.Enter both a
timestamp.columns.mappingvalue and anincrementing.column.nameto enable timestamp+incrementing mode. This mode uses two columns, a timestamp column that detects new and modified rows, and a strictly incrementing column which provides a globally unique ID for updates so each row can be assigned a unique stream offset. By default, the connector only detectstable.typeswith typeTABLEfrom the source database. EnterVIEWfor virtual tables created from joining one or more tables.
If you define a schema pattern in your database, you need to enter the
schema.patternproperty to fetch table metadata from the database.""retrieves table metadata for tables not using a schema.null(default) indicates that the schema name is not used to narrow the search and that all table metadata is fetched, regardless of the schema."output.data.format": Sets the output Kafka record value format (data coming from the connector). Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON. You must have Confluent Cloud Schema Registry configured if using a schema-based message format (for example, Avro, JSON_SR (JSON Schema), or Protobuf)."db.timezone": Identifies the database timezone. This can be any valid database timezone. The default is UTC. For more information, see this list of database timezones.
Note
To enable CSFLE or CSPE for data encryption, specify the following properties:
csfle.enabled: Flag to indicate whether the connector honors CSFLE or CSPE rules.sr.service.account.id: A Service Account to access the Schema Registry and associated encryption rules or keys with that schema.
For more information on CSFLE or CSPE setup, see Manage encryption for connectors.
Single Message Transforms: See the Single Message Transforms (SMT) documentation for details about adding SMTs using the CLI.
For all property values and definitions, see Configuration properties.
Step 4: Load the properties file and create the connector
Enter the following command to load the configuration and start the connector:
confluent connect cluster create --config-file <file-name>.json
For example:
confluent connect cluster create --config-file ibmdb2-source.json
Example output:
Created connector confluent-ibmdb2-source lcc-ix4dl
Step 5: Check the connector status
Enter the following command to check the connector status:
confluent connect cluster list
Example output:
ID | Name | Status | Type
+-----------+------------------------------+---------+-------+
lcc-ix4dl | confluent-ibmdb2-source | RUNNING | source
Step 6: Check the Kafka topic
After the connector is running, verify that messages are populating your Kafka topic.
For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.
Configuration properties
Use the following configuration properties with the fully-managed connector. For self-managed connector property definitions and other details, see the connector docs in Self-managed connectors for Confluent Platform.
How should we connect to your data?
nameSets a name for your connector.
Type: string
Valid Values: A string at most 64 characters long
Importance: high
Kafka Cluster credentials
kafka.auth.modeKafka Authentication mode. It can be one of KAFKA_API_KEY or SERVICE_ACCOUNT. It defaults to KAFKA_API_KEY mode, whenever possible.
Type: string
Valid Values: SERVICE_ACCOUNT, KAFKA_API_KEY
Importance: high
kafka.api.keyKafka API Key. Required when kafka.auth.mode==KAFKA_API_KEY.
Type: password
Importance: high
kafka.service.account.idThe Service Account that will be used to generate the API keys to communicate with Kafka Cluster.
Type: string
Importance: high
kafka.api.secretSecret associated with Kafka API key. Required when kafka.auth.mode==KAFKA_API_KEY.
Type: password
Importance: high
Schema Config
schema.context.nameAdd a schema context name. A schema context represents an independent scope in Schema Registry. It is a separate sub-schema tied to topics in different Kafka clusters that share the same Schema Registry instance. If not used, the connector uses the default schema configured for Schema Registry in your Confluent Cloud environment.
Type: string
Default: default
Importance: medium
How do you want to prefix table names?
topic.prefixPrefix to prepend to table names to generate the name of the Apache Kafka® topic to publish data to.
Type: string
Importance: high
How should we connect to your database?
connection.hostDepending on the service environment, certain network access limitations may exist. Make sure the connector can reach your service. Do not include jdbc:xxxx:// in the connection hostname property (e.g. database-1.abc234ec2.us-west.rds.amazonaws.com).
Type: string
Importance: high
connection.portJDBC connection port.
Type: int
Valid Values: [0,…,65535]
Importance: high
connection.userJDBC connection user.
Type: string
Importance: high
connection.passwordJDBC connection password.
Type: password
Importance: high
db.nameJDBC database name.
Type: string
Importance: high
ssl.modeWhat SSL mode should we use to connect to your database. prefer allows for the connection to not be encrypted and require allows for the connection to be encrypted but does not do certificate validation on the server. verify-ca and verify-full require a file containing SSL CA certificate to be provided. The server’s certificate will be verified to be signed by one of these authorities.`verify-ca` will verify that the server certificate is issued by a trusted CA. verify-full will verify that the server certificate is issued by a trusted CA and that the server hostname matches that in the certificate. Client authentication is not performed.
Type: string
Default: prefer
Importance: high
ssl.truststorefileThe binary trust store file that contains the server’s CA certificate. Only required if you use verify-ca or verify-full ssl mode. The connector supports files in JKS format. For REST API usage, you must base64-encode the binary trust store file and prefix it with
data:text/plain;base64,. For example, first, encode the filebase64_truststore=<span>(cat /path/to/truststore.jks | base64)and then usedata:text/plain;base64,</span>base64_truststoreas the value.Type: password
Default: [hidden]
Importance: low
ssl.truststorepasswordThe trust store password containing server CA certificate. Only required if using verify-ca or verify-full ssl mode.
Type: password
Default: [hidden]
Importance: low
Database details
table.include.listA comma-separated list of regular expressions that match the fully-qualified names of tables to be copied. Use a comma-separated list to specify multiple regular expressions. Table names are case-sensitive. For example,
table.include.list: schema1.customer.*,schema2.order.*. If specified,table.whitelistcannot be set.Type: list
Importance: medium
table.exclude.listA comma-separated list of regular expressions that match the fully-qualified names of tables to be excluded from copying. Use a comma-separated list to specify multiple regular expressions. Table names are case-sensitive. For example,
table.exclude.list: schema1.customer.*,schema2.order.*. If specified,table.whitelistcannot not be set.Type: list
Importance: medium
queryIf specified, the connector uses this custom SQL query to read source records, which allows for operations like joining tables or selecting subsets of data. Providing a query instructs the connector to read only the result set instead of performing a full table copy. This configuration supports different query modes with the incremental query properly constructed by appending a WHERE clause (For more information, Incremental Query Modes - <https://docs.confluent.io/kafka-connectors/jdbc/current/source-connector/overview.html#incremental-query-modes>). Note that only SELECT statements are supported. Always adhere to security best practices, like enforcing strict authorization via <https://docs.confluent.io/cloud/current/connectors/managed-connector-rbac.html#managed-connector-rbac>, applying appropriate :ref: network access controls - <https://docs.confluent.io/cloud/current/security/access-control/ip-filtering/manage-ip-filters.html> for control plane APIs, and following the principle of least privilege when provisioning identities or credentials for any third-party systems.
Type: password
Default: [hidden]
Importance: medium
table.typesBy default, the JDBC connector will only detect tables with type TABLE from the source Database. This config allows a command separated list of table types to extract.
Type: list
Default: TABLE
Importance: medium
schema.patternSchema pattern to fetch table metadata from the database.
Type: string
Importance: high
db.timezoneName of the JDBC timezone used in the connector when querying with time-based criteria. Defaults to UTC.
Type: string
Default: UTC
Importance: medium
numeric.mappingMap NUMERIC values by precision and optionally scale to integral or decimal types. Use
noneif all NUMERIC columns are to be represented by Connect’s DECIMAL logical type. Usebest_fitif NUMERIC columns should be cast to Connect’s INT8, INT16, INT32, INT64, or FLOAT64 based upon the column’s precision and scale. Usebest_fit_eager_doubleif, in addition to the properties of best_fit described above, it is desirable to always cast NUMERIC columns with scale to Connect FLOAT64 type, despite potential of loss in accuracy. Useprecision_onlyto map NUMERIC columns based only on the column’s precision assuming that column’s scale is 0. Thenoneoption is the default, but may lead to serialization issues with Avro since Connect’s DECIMAL type is mapped to its binary representation, andbest_fitwill often be preferred since it maps to the most appropriate primitive type.Type: string
Default: none
Importance: low
timestamp.granularityDefine the granularity of the Timestamp column. CONNECT_LOGICAL (default): represents timestamp values using Kafka Connect built-in representations. MICROS_LONG: represents timestamp values as micros since epoch. MICROS_STRING: represents timestamp values as micros since epoch in string. MICROS_ISO_DATETIME_STRING: uses iso format for timestamps in micros. NANOS_LONG: represents timestamp values as nanos since epoch. NANOS_STRING: represents timestamp values as nanos since epoch in string. NANOS_ISO_DATETIME_STRING: uses iso format
Type: string
Default: CONNECT_LOGICAL
Importance: low
Mode
modeThe mode for updating a table each time it is polled. BULK: perform a bulk load of the entire table each time it is polled. TIMESTAMP: use a timestamp (or timestamp-like) column to detect new and modified rows. This assumes the column is updated with each write, and that values are monotonically incrementing, but not necessarily unique. INCREMENTING: use a strictly incrementing column on each table to detect only new rows. Note that this will not detect modifications or deletions of existing rows. TIMESTAMP AND INCREMENTING: use two columns, a timestamp column that detects new and modified rows and a strictly incrementing column which provides a globally unique ID for updates so each row can be assigned a unique stream offset.
Type: string
Default: “”
Importance: medium
timestamp.columns.mappingA comma-separated list of table regex to timestamp columns mappings. On specifying multiple timestamp columns, COALESCE SQL function would be used to find out the effective timestamp for a row. Expected format is
regex1:[col1|col2],regex2:[col3]. Regexes would be matched against the fully-qualified table names. Identifier names are case sensitive. Every table included for capture should match exactly one of the provided mappings. An example for a valid input would be.*\.customers.*:[updated_at|modified_at],.*\.orders.*:[changed_at].Type: list
Importance: medium
incrementing.column.mappingA comma-separated list of table regex to incrementing column mappings. Expected format is
regex1:col1,regex2:col2. Regexes would be matched against the fully-qualified table names. Identifier names are case sensitive. Every table included for capture should match exactly one of the provided mappings. An example for a valid input would be.*\.customers.*:id,.*\.orders.*:order_id.Type: list
Importance: medium
timestamp.column.name(Deprecated legacy configuration. Use timestamp.columns.mapping for new implementations.) Comma separated list of one or more timestamp columns to detect new or modified rows using the COALESCE SQL function. Rows whose first non-null timestamp value is greater than the largest previous timestamp value seen will be discovered with each poll. At least one column should not be nullable.
Type: list
Importance: medium
quote.sql.identifiersWhen to quote table names, column names, and other identifiers in SQL statements. For backward compatibility, the default value is ALWAYS.
Type: string
Default: ALWAYS
Valid Values: ALWAYS, NEVER
Importance: medium
transaction.isolation.modeIsolation level determines how transaction integrity is visible to other users and systems. DEFAULT: This is the default isolation level configured at the Database Server. READ_UNCOMMITTED: This is the lowest isolation level. At this level, one transaction may see dirty reads (that is, not-yet-committed changes made by other transactions). READ_COMMITTED: This level guarantees that any data read is already committed at the moment it is read. REPEATABLE_READ: In addition to the guarantees of the READ_COMMITTED level, this option also guarantees that any data read cannot change, if the transaction reads the same data again. However, phantom reads are possible. SERIALIZABLE: This is the highest isolation level. In addition to everything REPEATABLE_READ guarantees, it also eliminates phantom reads.
Type: string
Default: DEFAULT
Valid Values: DEFAULT, READ_COMMITTED, READ_UNCOMMITTED, REPEATABLE_READ, SERIALIZABLE
Importance: medium
timestamp.initialThe epoch timestamp used for initial queries that use timestamp criteria. The value -1 sets the initial timestamp to the current time. If not specified, the connector retrieves all data. Once the connector has managed to successfully record a source offset, this property has no effect even if changed to a different value later on.
Type: long
Valid Values: [-1,…]
Importance: medium
date.calendar.systemThe time elapsed from epoch populated in the end table topic for DATE or TIMESTAMP type columns can have two different values based upon the Calendar used to interpret it. If LEGACY is used, it will use the hybrid Gregorian/Julian calendar which was the default in the older java date time APIs. However, if ‘PROLEPTIC_GREGORIAN’ is used, then it will use the proleptic gregorian calendar which extends the Gregorian rules backward indefinitely and does not apply the 1582 cutover. This matches the behavior of modern Java date/time APIs (java.time). This is defaulted to LEGACY for backward compatibility. Changing this configuration on an existing connector might lead to a drift in the kafka topic record values.
Type: string
Default: LEGACY
Importance: medium
Connection details
poll.interval.msFrequency in ms to poll for new data in each table.
Type: int
Default: 5000 (5 seconds)
Valid Values: [100,…]
Importance: high
batch.max.rowsMaximum number of rows to include in a single batch when polling for new data. This setting can be used to limit the amount of data buffered internally in the connector.
Type: int
Default: 100
Valid Values: [1,…,5000]
Importance: low
timestamp.delay.interval.msHow long to wait after a row with a certain timestamp appears before we include it in the result. You may choose to add some delay to allow transactions with an earlier timestamp to complete. The first execution will fetch all available records (starting at timestamp 0) until current time minus the delay. Every following execution will get data from the last time we fetched until current time minus the delay.
Type: int
Default: 0
Valid Values: [0,…]
Importance: high
Output messages
output.data.formatSets the output Kafka record value format. Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON. Note that you need to have Confluent Cloud Schema Registry configured if using a schema-based message format like AVRO, JSON_SR, and PROTOBUF
Type: string
Default: JSON
Importance: high
Number of tasks for this connector
tasks.maxMaximum number of tasks for the connector.
Type: int
Valid Values: [1,…]
Importance: high
Additional Configs
header.converterThe converter class for the headers. This is used to serialize and deserialize the headers of the messages.
Type: string
Importance: low
producer.override.compression.typeThe compression type for all data generated by the producer. Valid values are none, gzip, snappy, lz4, and zstd.
Type: string
Importance: low
producer.override.linger.msThe producer groups together any records that arrive in between request transmissions into a single batched request. More details can be found in the documentation: https://docs.confluent.io/platform/current/installation/configuration/producer-configs.html#linger-ms.
Type: long
Valid Values: [100,…,1000]
Importance: low
value.converter.allow.optional.map.keysAllow optional string map key when converting from Connect Schema to Avro Schema. Applicable for Avro Converters.
Type: boolean
Importance: low
value.converter.auto.register.schemasSpecify if the Serializer should attempt to register the Schema.
Type: boolean
Importance: low
value.converter.connect.meta.dataAllow the Connect converter to add its metadata to the output schema. Applicable for Avro Converters.
Type: boolean
Importance: low
value.converter.enhanced.avro.schema.supportEnable enhanced schema support to preserve package information and Enums. Applicable for Avro Converters.
Type: boolean
Importance: low
value.converter.enhanced.protobuf.schema.supportEnable enhanced schema support to preserve package information. Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.flatten.unionsWhether to flatten unions (oneofs). Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.generate.index.for.unionsWhether to generate an index suffix for unions. Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.generate.struct.for.nullsWhether to generate a struct variable for null values. Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.int.for.enumsWhether to represent enums as integers. Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.latest.compatibility.strictVerify latest subject version is backward compatible when use.latest.version is true.
Type: boolean
Importance: low
value.converter.object.additional.propertiesWhether to allow additional properties for object schemas. Applicable for JSON_SR Converters.
Type: boolean
Importance: low
value.converter.optional.for.nullablesWhether nullable fields should be specified with an optional label. Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.optional.for.proto2Whether proto2 optionals are supported. Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.scrub.invalid.namesWhether to scrub invalid names by replacing invalid characters with valid characters. Applicable for Avro and Protobuf Converters.
Type: boolean
Importance: low
value.converter.use.latest.versionUse latest version of schema in subject for serialization when auto.register.schemas is false.
Type: boolean
Importance: low
value.converter.use.optional.for.nonrequiredWhether to set non-required properties to be optional. Applicable for JSON_SR Converters.
Type: boolean
Importance: low
value.converter.wrapper.for.nullablesWhether nullable fields should use primitive wrapper messages. Applicable for Protobuf Converters.
Type: boolean
Importance: low
value.converter.wrapper.for.raw.primitivesWhether a wrapper message should be interpreted as a raw primitive at root level. Applicable for Protobuf Converters.
Type: boolean
Importance: low
errors.toleranceUse this property if you would like to configure the connector’s error handling behavior. WARNING: This property should be used with CAUTION for SOURCE CONNECTORS as it may lead to dataloss. If you set this property to ‘all’, the connector will not fail on errant records, but will instead log them (and send to DLQ for Sink Connectors) and continue processing. If you set this property to ‘none’, the connector task will fail on errant records.
Type: string
Default: none
Importance: low
key.converter.key.schema.id.serializerThe class name of the schema ID serializer for keys. This is used to serialize schema IDs in the message headers.
Type: string
Default: io.confluent.kafka.serializers.schema.id.PrefixSchemaIdSerializer
Importance: low
key.converter.key.subject.name.strategyHow to construct the subject name for key schema registration.
Type: string
Default: TopicNameStrategy
Importance: low
value.converter.decimal.formatSpecify the JSON/JSON_SR serialization format for Connect DECIMAL logical type values with two allowed literals:
BASE64 to serialize DECIMAL logical types as base64 encoded binary data and
NUMERIC to serialize Connect DECIMAL logical type values in JSON/JSON_SR as a number representing the decimal value.
Type: string
Default: BASE64
Importance: low
value.converter.flatten.singleton.unionsWhether to flatten singleton unions. Applicable for Avro and JSON_SR Converters.
Type: boolean
Default: false
Importance: low
value.converter.ignore.default.for.nullablesWhen set to true, this property ensures that the corresponding record in Kafka is NULL, instead of showing the default column value. Applicable for AVRO,PROTOBUF and JSON_SR Converters.
Type: boolean
Default: false
Importance: low
value.converter.reference.subject.name.strategySet the subject reference name strategy for value. Valid entries are DefaultReferenceSubjectNameStrategy or QualifiedReferenceSubjectNameStrategy. Note that the subject reference name strategy can be selected only for PROTOBUF format with the default strategy being DefaultReferenceSubjectNameStrategy.
Type: string
Default: DefaultReferenceSubjectNameStrategy
Importance: low
value.converter.replace.null.with.defaultWhether to replace fields that have a default value and that are null to the default value. When set to true, the default value is used, otherwise null is used. Applicable for JSON Converter.
Type: boolean
Default: true
Importance: low
value.converter.schemas.enableInclude schemas within each of the serialized values. Input messages must contain schema and payload fields and may not contain additional fields. For plain JSON data, set this to false. Applicable for JSON Converter.
Type: boolean
Default: false
Importance: low
value.converter.value.schema.id.serializerThe class name of the schema ID serializer for values. This is used to serialize schema IDs in the message headers.
Type: string
Default: io.confluent.kafka.serializers.schema.id.PrefixSchemaIdSerializer
Importance: low
value.converter.value.subject.name.strategyDetermines how to construct the subject name under which the value schema is registered with Schema Registry.
Type: string
Default: TopicNameStrategy
Importance: low
Auto-restart policy
auto.restart.on.user.errorEnable connector to automatically restart on user-actionable errors.
Type: boolean
Default: true
Importance: medium
Next steps
For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud for Apache Flink, see the Cloud ETL Demo. This example also shows how to use Confluent CLI to manage your resources in Confluent Cloud.
