apache/seatunnel · error · SeaTunnelException
Error reading MySQL variables: ${e.getMessage()}
Error message
Error reading MySQL variables: ${e.getMessage()} What it means
MySqlDialect.isDataCollectionIdCaseSensitive opens a JDBC connection and queries server variables (lower_case_table_names) to determine whether table names are case sensitive. Any SQLException from opening the connection or running the query is wrapped in a SeaTunnelException with this message, with the original SQLException as cause.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/MySqlDialect.java:75
private transient MySqlSchema mySqlSchema;
private final Map<TableId, CatalogTable> tableMap;
public MySqlDialect(MySqlSourceConfigFactory configFactory, List<CatalogTable> catalogTables) {
this.sourceConfig = configFactory.create(0);
this.tableMap = CatalogTableUtils.convertTables(catalogTables);
}
@Override
public String getName() {
return DatabaseIdentifier.MYSQL;
}
@Override
public boolean isDataCollectionIdCaseSensitive(JdbcSourceConfig sourceConfig) {
try (JdbcConnection jdbcConnection = openJdbcConnection(sourceConfig)) {
return isDataCollectionIdCaseSensitive(jdbcConnection);
} catch (SQLException e) {
throw new SeaTunnelException("Error reading MySQL variables: " + e.getMessage(), e);
}
}
private boolean isDataCollectionIdCaseSensitive(JdbcConnection jdbcConnection) {
return isTableIdCaseSensitive(jdbcConnection);
}
@Override
public JdbcConnection openJdbcConnection(JdbcSourceConfig sourceConfig) {
return MySqlConnectionUtils.createMySqlConnection(sourceConfig.getDbzConfiguration());
}
@Override
public ChunkSplitter createChunkSplitter(JdbcSourceConfig sourceConfig) {
return new MySqlChunkSplitter(sourceConfig, this);
}
@OverrideView on GitHub (pinned to cf67b549a7)
Solutions
- Read the cause SQLException for the root reason (Access denied, Communications link failure, Unknown database) and fix accordingly.
- Verify hostname, port, username, password, and database in the source config; test with a mysql client from the same host.
- Align SSL settings (useSSL/requireSSL) with the server's TLS requirements.
- Check network/firewall rules and increase connectTimeout if the network is slow.
Example fix
// before url = "jdbc:mysql://wrong-host:3306/mydb" // after url = "jdbc:mysql://mysql-prod.internal:3306/mydb" // reachable host, matching credentials
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight connectivity check
try (Connection c = DriverManager.getConnection(url, user, pass)) {
c.createStatement().executeQuery("SHOW VARIABLES LIKE 'lower_case_table_names'");
} Try / catch
try { dialect.isDataCollectionIdCaseSensitive(config); } catch (SeaTunnelException e) { logger.error("MySQL variable read failed: {}", e.getCause().getMessage()); throw e; } Prevention
- Run a connection smoke test in CI against the target MySQL host/port.
- Keep credentials in a secret store and rotate without typos.
- Match SSL settings (useSSL) between client and server.
When it happens
Trigger: SQLException while opening the JDBC connection or reading MySQL variables inside isDataCollectionIdCaseSensitive — bad credentials, unreachable host/port, unknown database, SSL mismatch, or socket timeout.
Common situations: Wrong hostname/port in config; MySQL account access denied; firewall or security group blocking 3306; useSSL incompatibility with server; DNS resolution failure at job startup.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- Timed out after <actualSeconds> seconds while waiting to con
- Read the binlog offset error
- Failed to get connection, interrupted while doing another at
- Get connection failed after retry times
- Failed to discover remaining tables to capture
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/a5341faad412e941.
Report an issue: GitHub.