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);
    }

    @Override

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the cause SQLException for the root reason (Access denied, Communications link failure, Unknown database) and fix accordingly.
  2. Verify hostname, port, username, password, and database in the source config; test with a mysql client from the same host.
  3. Align SSL settings (useSSL/requireSSL) with the server's TLS requirements.
  4. 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

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/a5341faad412e941. Report an issue: GitHub.