This guide covers two connector options for sinking data to SQL Server:Documentation Index
Fetch the complete documentation index at: https://docs.risingwave.com/llms.txt
Use this file to discover all available pages before exploring further.
- JDBC connector (
connector='jdbc') - Recommended for better performance - SQL Server native connector (
connector='sqlserver')
sqlserver_sink.slt demo in the e2e_test directory of the RisingWave repository.
Prerequisites
Before sinking data from RisingWave to SQL Server, please ensure the following:- The SQL Server table you want to sink to is accessible from RisingWave.
- You have an upstream materialized view or table in RisingWave that you can sink data from.
- If you are running RisingWave locally from binaries and intend to use the JDBC sink connector, make sure you have JDK 11 or later versions installed in your environment.
Create a sink
RisingWave supports two connector types for SQL Server sinks. The JDBC connector is recommended for better performance.Syntax
Parameters (JDBC connector)
| Parameter Names | Description |
|---|---|
| connector | Required. Sink connector type. Use jdbc for the JDBC connector. |
| jdbc.url | Required. The JDBC URL of the destination database necessary for the driver to recognize and connect to the database. |
| table.name | Required. The SQL Server table you want to sink to. |
| schema.name | Optional. The SQL Server schema name. If not specified, the default schema will be used. |
| type | Required. Allowed values: append-only and upsert. |
| force_append_only | Optional. If true, forces the sink to be append-only, even if it cannot be. |
| primary_key | Conditional. The primary keys of the sink. Use ’,’ to delimit the primary key columns. Primary keys are required for upsert sinks. |
| jdbc.query.timeout | Optional. Specifies the timeout for the operations to downstream. If not set, the default is 60s. |
| jdbc.auto.commit | Optional. Controls whether to automatically commit transactions for JDBC sink. If not set, the default is false. |
| tcp.keepalive.enable | Optional. Enables TCP keepalive for the connection to the downstream database. If not set, the default is false. |
| tcp.keepalive.idle | Optional. The time (in seconds) the connection must be idle before the first keepalive probe is sent. Takes effect only when tcp.keepalive.enable is true. If not set, the default is 600 (10 minutes). |
| tcp.keepalive.interval | Optional. The time (in seconds) between consecutive keepalive probes. Takes effect only when tcp.keepalive.enable is true. If not set, the default is 10. |
| tcp.keepalive.count | Optional. The number of unacknowledged keepalive probes before the connection is considered dead. Takes effect only when tcp.keepalive.enable is true. If not set, the default is 3. |
Parameters (SQL Server native connector)
| Parameter Names | Description |
|---|---|
| connector | Required. Sink connector type. Use sqlserver for the native SQL Server connector. |
| type | Required. Allowed values: append-only and upsert. |
| force_append_only | Optional. If true, forces the sink to be append-only, even if it cannot be. |
| primary_key | Conditional. The primary keys of the sink. Use ’,’ to delimit the primary key columns. Primary keys are required for upsert sinks. |
| sqlserver.host | Required. The SQL Server host. |
| sqlserver.port | Required. The SQL Server port. |
| sqlserver.user | Required. The user for SQL Server access. |
| sqlserver.password | Required. The password for SQL Server access. |
| sqlserver.database | Required. The SQL Server database you want to sink to. |
| sqlserver.table | Required. The SQL Server table you want to sink to. |
Examples
jdbc as connector
sqlserver as connector
Data type mapping
The following table shows the corresponding data types between RisingWave and SQL Server that should be specified when creating a sink. For details on native RisingWave data types, see Overview of data types.| SQL Server type | RisingWave type |
|---|---|
| bit | boolean |
| smallint | smallint |
| int | integer |
| bigint | bigint |
| float(24) | real |
| float(53) | double |
| decimal | decimal |
| date | date |
| nvarchar | varchar |
| time | time |
| datetime2 | time without time zone |
| bigint | timestamp without time zone |
| No support | interval |
| No support | struct |
| No support | array |
| varbinary | bytea |
| No support | jsonb |
| No support | serial |