{"record":{"id":"9a92e5005bc1e660","repo":"apache/seatunnel","slug":"error-to-discover-tables-e-getmessage","errorCode":null,"errorMessage":"Error to discover tables: ${e.getMessage()}","messagePattern":"Error to discover tables: (.+?)","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/MySqlDialect.java","lineNumber":100,"sourceCode":"\n    @Override\n    public JdbcConnection openJdbcConnection(JdbcSourceConfig sourceConfig) {\n        return MySqlConnectionUtils.createMySqlConnection(sourceConfig.getDbzConfiguration());\n    }\n\n    @Override\n    public ChunkSplitter createChunkSplitter(JdbcSourceConfig sourceConfig) {\n        return new MySqlChunkSplitter(sourceConfig, this);\n    }\n\n    @Override\n    public List<TableId> discoverDataCollections(JdbcSourceConfig sourceConfig) {\n        MySqlSourceConfig mySqlSourceConfig = (MySqlSourceConfig) sourceConfig;\n        try (JdbcConnection jdbcConnection = openJdbcConnection(sourceConfig)) {\n            return TableDiscoveryUtils.listTables(\n                    jdbcConnection, mySqlSourceConfig.getTableFilters());\n        } catch (SQLException e) {\n            throw new SeaTunnelException(\"Error to discover tables: \" + e.getMessage(), e);\n        }\n    }\n\n    @Override\n    public TableChanges.TableChange queryTableSchema(JdbcConnection jdbc, TableId tableId) {\n        if (mySqlSchema == null) {\n            mySqlSchema =\n                    new MySqlSchema(sourceConfig, isDataCollectionIdCaseSensitive(jdbc), tableMap);\n        }\n        return mySqlSchema.getTableSchema(jdbc, tableId);\n    }\n\n    @Override\n    public MySqlSourceFetchTaskContext createFetchTaskContext(\n            SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) {\n        return new MySqlSourceFetchTaskContext(taskSourceConfig, this);\n    }\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/MySqlDialect.java#L82-L118","documentation":"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.","triggerScenarios":"SQLException while listing tables in discoverDataCollections (called via discoverTables) — connection failure, missing SELECT/SHOW privileges on the databases or tables, or metadata query failure.","commonSituations":"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.","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."],"exampleFix":"// before\nGRANT SELECT ON shop.orders TO 'cdc'@'%';  // other captured tables invisible\n// after\nGRANT SELECT ON shop.* TO 'cdc'@'%';  // all tables in captured schema visible","handlingStrategy":"try-catch","validationCode":"// Verify the user can see the configured tables\ntry (ResultSet rs = conn.createStatement().executeQuery(\n        \"SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA='shop' AND TABLE_NAME='orders'\")) {\n    if (rs.next() && rs.getInt(1) == 0) throw new IllegalStateException(\"Table not visible: check grants/database-names\");\n}","typeGuard":null,"tryCatchPattern":"try { dialect.discoverDataCollections(config); } catch (SeaTunnelException e) { logger.error(\"table discovery failed: {}\", e.getCause().getMessage()); throw e; }","preventionTips":["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."],"tags":["mysql","jdbc","table-discovery","privileges"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}