apache/seatunnel · error · SeaTunnelException
Error to discover tables: ${e.getMessage()}
Error message
Error to discover tables: ${e.getMessage()} What it means
Thrown by SqlServerDialect.discoverDataCollections() when listing tables or verifying their CDC capture status throws a SQLException. It wraps the driver error into a SeaTunnelException reporting 'Error to discover tables'.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/SqlServerDialect.java:101
sourceConfig.getDbzConfiguration());
}
@Override
public ChunkSplitter createChunkSplitter(JdbcSourceConfig sourceConfig) {
return new SqlServerChunkSplitter(sourceConfig, this);
}
@Override
public List<TableId> discoverDataCollections(JdbcSourceConfig sourceConfig) {
SqlServerSourceConfig sqlServerSourceConfig = (SqlServerSourceConfig) sourceConfig;
try (JdbcConnection jdbcConnection = openJdbcConnection(sourceConfig)) {
List<TableId> tables =
TableDiscoveryUtils.listTables(
jdbcConnection, sqlServerSourceConfig.getTableFilters());
this.checkAllTablesEnabledCapture(jdbcConnection, tables);
return tables;
} catch (SQLException e) {
throw new SeaTunnelException("Error to discover tables: " + e.getMessage(), e);
}
}
@Override
public void checkAllTablesEnabledCapture(JdbcConnection jdbcConnection, List<TableId> tableIds)
throws SQLException {
Map<String, List<TableId>> databases =
tableIds.stream()
.collect(Collectors.groupingBy(TableId::catalog, Collectors.toList()));
for (String database : databases.keySet()) {
Set<TableId> tables =
((SqlServerConnection) jdbcConnection)
.getChangeTables(database).stream()
.map(SqlServerChangeTable::getSourceTableId)
.collect(Collectors.toSet());
for (TableId tableId : databases.get(database)) {
if (!tables.contains(tableId)) {
throw new SeaTunnelException(View on GitHub (pinned to cf67b549a7)
Solutions
- Verify connectivity: host, port, database name, and login credentials in the source config
- Grant the login permission to read catalog views (VIEW DEFINITION / db_datareader)
- Check the wrapped SQLException cause for the precise driver message
- Retry on transient failures; enable connection retry/timeouts
- Confirm the database is a full (not partial) recovery model with CDC reachable
Example fix
// before
// no preflight check
dialect.discoverDataCollections(config);
// after
try (JdbcConnection c = dialect.openJdbcConnection(config)) {
c.connection().isValid(10); // fail early with a clearer error
}
dialect.discoverDataCollections(config); Defensive patterns
Strategy: validation
Validate before calling
-- preflight: all configured tables exist and are CDC-enabled
SELECT t.name FROM sys.tables t
JOIN sys.databases d ON d.is_cdc_enabled = 1
WHERE t.name IN ('table1','table2');
-- and per table: SELECT * FROM sys.cdc_change_tables WHERE source_object = N'table1'; Try / catch
try {
tables = dialect.discoverDataCollections(config);
} catch (SeaTunnelException e) {
if (e.getCause() instanceof SQLException s && "08001".equals(s.getSQLState())) {
// transient connectivity — retry with backoff
}
throw e;
} Prevention
- Run a connectivity preflight (host/port/db/user/password) before job start
- Enable CDC on every table matched by the table-names filter
- Grant catalog-read permissions to the connector login
- Configure JDBC connect/socket timeouts with retries
When it happens
Trigger: TableDiscoveryUtils.listTables(jdbcConnection, tableFilters) or checkAllTablesEnabledCapture hits a SQLException — connection failure, permission denial on the catalog, or query timeout against sys.tables / change tables.
Common situations: SQL Server unreachable (wrong host/port, firewall); login lacking catalog read permission; database name misspelled in config; transient network blips during job startup.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- Failed to discover captured tables for enumerator
- Failed to discover remaining tables to capture
- Error to discover tables:
- Couldn't obtain database name
- Error to check tables: ${e.getMessage()}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1334b0a2b98ee1c4.
Report an issue: GitHub.