apache/seatunnel · error · SeaTunnelException
Error to discover tables
Error message
Error to discover tables: ${e.getMessage()} What it means
MySqlDialect.discoverDataCollections connects to MySQL and calls TableDiscoveryUtils.listTables to enumerate the tables matching the configured table filters. A SQLException during discovery is wrapped in a SeaTunnelException with this message, so the connector fails fast instead of proceeding with no table list.
Solutions
- Inspect the cause SQLException for the underlying reason (access denied, connection failure) and fix that first.
- Grant the connector user SELECT and SHOW VIEW on the captured databases, plus SHOW DATABASES visibility.
- Verify database-names/table-names entries exist and match actual case-sensitive names on the server.
- Re-test connectivity and retry; ensure the connection is stable for the duration of metadata discovery.
Example fix
// before GRANT SELECT ON shop.orders TO 'cdc'@'%'; // other captured tables invisible // after GRANT SELECT ON shop.* TO 'cdc'@'%'; // all tables in captured schema visible
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the user can see the configured tables
try (ResultSet rs = conn.createStatement().executeQuery(
"SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA='shop' AND TABLE_NAME='orders'")) {
if (rs.next() && rs.getInt(1) == 0) throw new IllegalStateException("Table not visible: check grants/database-names");
} Try / catch
try { dialect.discoverDataCollections(config); } catch (SeaTunnelException e) { logger.error("table discovery failed: {}", e.getCause().getMessage()); throw e; } Prevention
- Grant SELECT on all captured schemas, not just individual tables.
- Confirm table names' case matches the server's lower_case_table_names setting.
- Validate database-names/table-names config against SHOW DATABASES output.
When it happens
Trigger: SQLException while listing tables in discoverDataCollections (called via discoverTables) — connection failure, missing SELECT/SHOW privileges on the databases or tables, or metadata query failure.
Common situations: database-names/table-names config pointing at schemas the user cannot see; access denied on information_schema; connection dropped during large metadata scans; typo'd database name causing query errors.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Unexpected error while connecting to MySQL and looking at…
- Unexpected error while connecting to MySQL and looking at…
- Catalog not found, loading tables from jdbc directly. url
- COMMON-17
- COMMON-19
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/9a92e5005bc1e660.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/MySqlDialect.java:100
@Override
public JdbcConnection openJdbcConnection(JdbcSourceConfig sourceConfig) {
return MySqlConnectionUtils.createMySqlConnection(sourceConfig.getDbzConfiguration());
}
@Override
public ChunkSplitter createChunkSplitter(JdbcSourceConfig sourceConfig) {
return new MySqlChunkSplitter(sourceConfig, this);
}
@Override
public List<TableId> discoverDataCollections(JdbcSourceConfig sourceConfig) {
MySqlSourceConfig mySqlSourceConfig = (MySqlSourceConfig) sourceConfig;
try (JdbcConnection jdbcConnection = openJdbcConnection(sourceConfig)) {
return TableDiscoveryUtils.listTables(
jdbcConnection, mySqlSourceConfig.getTableFilters());
} catch (SQLException e) {
throw new SeaTunnelException("Error to discover tables: " + e.getMessage(), e);
}
}
@Override
public TableChanges.TableChange queryTableSchema(JdbcConnection jdbc, TableId tableId) {
if (mySqlSchema == null) {
mySqlSchema =
new MySqlSchema(sourceConfig, isDataCollectionIdCaseSensitive(jdbc), tableMap);
}
return mySqlSchema.getTableSchema(jdbc, tableId);
}
@Override
public MySqlSourceFetchTaskContext createFetchTaskContext(
SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) {
return new MySqlSourceFetchTaskContext(taskSourceConfig, this);
}
View on GitHub (pinned to cf67b549a7)