SQL Server
Connect SQL Server as a source to tapstate for full load (Snapshot) and Change Data Capture (CDC).
Connector profile
- Category
- Databases
- Guide maturity
- GAGenerally available
- Role in this guide
- Source
- Capabilities
- SnapshotCDCDDL capture
- Compatibility
- SQL Server 2008–2022
Connect SQL Server as a source for an initial full load and CDC into operational state or analytics targets. Complete the database preparation that matches the read mode you plan to use.
Before you begin
Connector availability and licensing
The SQL Server connector artifact bundles the Microsoft JDBC Driver under the MIT License; commercial connector use remains subject to the applicable agreement. It is distributed as an official preview artifact separate from the base server image. Before applying SQL Server connections on a new or upgraded server, register the connector:
connectors
register sqlserverIn production and air-gapped environments, you can also mount the connector JAR into TAPSTATE_CONNECTORS_SEED_DIR for automatic boot-time registration. See When registration is required.
Source
Choose the outcome you need. Each tab is a complete preparation path; you do not need to combine steps from both tabs.
Create a connection
Tapstate stores each SQL Server connection as a .tap.yml file in the workspace.
Create tapstate-work/source/orders_sqlserver.tap.yml. The connection's mode
controls its read capability. For a full-load-only source, use mode: snapshot
instead of mode: cdc.
version: tapstate/v1
kind: source
id: orders_sqlserver
connector: sqlserver
config:
host: sqlserver.internal
port: 1433
database: orders
schema: dbo
user: ${SQLSERVER_READER_USER}
password: ${SQLSERVER_READER_PASSWORD}
mode: cdc
tables:
- orders
- /customers_.*/For a CDC-capable source, use mode: cdc after enabling database and table CDC
and confirming that the cleanup window covers the recovery objective.
Connect SQL Server source to an operational target such as MongoDB:
version: tapstate/v1
kind: pipeline
id: orders_to_operational_state
source: orders_sqlserver
serve:
from: /.*/
sync:
- id: write_operational_state
source: operational_state
write_mode: upsert
ddl: failSQL Server is certified as a source in the current product path. Writing to SQL Server as a pipeline sync target is not supported.
Validate the configuration
tapstate validate --workdir tapstate-workvalid: 3 resources in tapstate-workThe resource shape, references, and applicable catalog rules were accepted. Runtime availability was not checked.
invalid: orders_source.tap.yml:12:1 dsl.unknown-field
Unknown field 'unexpected' at unexpected.Use the filename, location, diagnostic code, and suggested fix to update the resource.
Next, run the connection in a non-production environment and confirm credentials, network access, permissions, and a representative read or write.
Validation does not resolve the host, credentials, or a SQL Server instance. To verify the connection against the database, register the SQL Server connector, apply the workspace, and run test:
tapstate -w tapstate-workconnect http://127.0.0.1:8080
login admin
register sqlserver -o json
apply
test orders_sqlserver -o jsonThen verify in a staging table that:
- the account can discover and snapshot the table;
- the capture instance produces insert, update, and delete rows;
- the cleanup window exceeds the tested recovery time;
- data types match downstream consumer expectations.
Limitations
- CDC must be enabled and retained for every participating table. If cleanup removes the saved position, recovery requires a new snapshot.
- Tables with CDC enabled cannot use
TRUNCATE TABLE, and renaming columns withsp_renameis not supported. - After a schema change, SQL Server does not automatically rebuild the capture instance. Disable and re-enable table CDC during a controlled window before resuming dependent DML.
- DDL and DML close together can create a gap because some implicitly committed DDL is not represented in
cdc.ddl_history. - SQL Server CDC processes up to 64 KB for an inserted or updated large field by default. Capture only the required columns when large fields are involved, and verify the effective limit with representative values in staging.
- A task that polls hundreds of capture tables can accumulate latency and load. Split very large table sets and measure the polling interval in staging.
- SQL Server 2005 does not provide native CDC and is not supported for CDC.
- Configure forced encryption on SQL Server when required, then use the connection settings supplied by your tapstate deployment.
Recreate CDC after a table change
Pause dependent writes or coordinate a maintenance window, then discover the current capture instance, disable it, and enable it again:
EXEC sys.sp_cdc_help_change_data_capture
@source_schema = N'dbo',
@source_name = N'orders';
GO
EXEC sys.sp_cdc_disable_table
@source_schema = N'dbo',
@source_name = N'orders',
@capture_instance = N'dbo_orders';
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'orders',
@role_name = N'cdc_reader',
@supports_net_changes = 1;
GORecreating a capture instance changes the available change-table history. Verify the pipeline's saved position and run an end-to-end reconciliation before resuming production traffic.
Reference
Connection settings
The documented current source path uses the fields below.
| Field | Required | Default | Use |
|---|---|---|---|
host | Yes | — | SQL Server instance host address or hostname. |
port | Yes | 1433 | SQL Server service port. Use a numeric integer. |
database | Yes | — | SQL Server database name. |
schema | Yes | — | Target schema to discover and replicate (e.g. dbo). |
user | No | — | Database account login (also accepted as username). |
password | No | — | Database account password or secret reference. |
cdcSolution | No | CT | CDC capture method: CT (native CDC change tables) or LogParser. |
timezone | No | Empty | Timezone offset for temporal conversions (e.g. +00:00, +08:00). |
Additional catalog fields
The catalog recognizes the fields below for encryption and advanced connection properties:
| Field | Use |
|---|---|
useSSL | Whether to enable SSL/TLS transport encryption (defaults to false). |
sslKeyPassword | Password protecting the client SSL/TLS key. |
hostNameInCertificate | Server hostname override used to validate the SSL/TLS certificate. |
extParams | Additional JDBC connection parameters accepted by the Microsoft driver. |
Database-side reference
This table summarizes SQL Server data behavior for the connector. Test uncommon types with representative data before migration.
| Signal | Database-side baseline |
|---|---|
| Versions | SQL Server 2008, 2008 R2, 2012, 2014, 2016, 2017, 2019, 2022 |
| Architecture | Single node |
| Source preparation | Snapshot and CDC prerequisites |
| DDL | Add, rename, alter, and drop columns, subject to CDC limitations |
Data compatibility
| Family | Database-side baseline |
|---|---|
| Text | char, varchar, nchar, nvarchar, text, ntext, varchar(max), nvarchar(max) |
| Integer | tinyint, smallint, int, bigint |
| Decimal | decimal, numeric, money, real, float |
| Date and time | date, time, datetime, datetime2, smalldatetime, datetimeoffset |
| Binary | binary, varbinary, varbinary(max), timestamp/rowversion |
| Other | uniqueidentifier, bit, image, xml, geography |