apache/seatunnel · error · DebeziumException
Error reading default database charsets: ${e.getMessage()}
Error message
Error reading default database charsets: ${e.getMessage()} What it means
MySqlJdbcContext.readDatabaseCollations queries MySQL's character set/collation metadata tables (e.g. information_schema or SHOW statements) to build the default charset map. Any SQLException raised while executing those queries is wrapped in a DebeziumException with this message, keeping the original SQLException as the cause. It signals the connector could not read server charset metadata, usually due to connectivity or privilege problems.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/legacy/MySqlJdbcContext.java:470
final Map<String, DatabaseLocales> charsets = new HashMap<>();
while (rs.next()) {
String dbName = rs.getString(1);
String charset = rs.getString(2);
String collation = rs.getString(3);
if (dbName != null && (charset != null || collation != null)) {
charsets.put(
dbName, new DatabaseLocales(charset, collation));
logger.debug(
"\t{} = {}, {}",
Strings.pad(dbName, 45, ' '),
Strings.pad(charset, 45, ' '),
Strings.pad(collation, 45, ' '));
}
}
return charsets;
});
} catch (SQLException e) {
throw new DebeziumException(
"Error reading default database charsets: " + e.getMessage(), e);
}
}
protected String setStatementFor(Map<String, String> variables) {
StringBuilder sb = new StringBuilder("SET ");
boolean first = true;
List<String> varNames = new ArrayList<>(variables.keySet());
Collections.sort(varNames);
for (String varName : varNames) {
if (first) {
first = false;
} else {
sb.append(", ");
}
sb.append(varName).append("=");
String value = variables.get(varName);
if (value == null) {View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect the wrapped 'cause' SQLException for the true root cause (connection refused, access denied, timeout) and fix that.
- Grant the replication/connector user sufficient privileges (SELECT on information_schema, plus REPLICATION SLAVE/CLIENT for CDC).
- Verify network connectivity and that MySQL is reachable from the connector host (test with mysql client).
- Increase connection/query timeouts in the JDBC options if the metadata query times out on a slow server.
Example fix
// before // user without metadata privileges // GRANT REPLICATION SLAVE ON *.* TO 'dbz'@'%'; // after GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'dbz'@'%';
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check MySQL reachability & privileges
try (Connection c = DriverManager.getConnection(url, user, pass)) {
c.createStatement().executeQuery("SELECT * FROM information_schema.COLLATIONS LIMIT 1");
} Try / catch
try { startConnector(); } catch (DebeziumException e) { logger.error("charset metadata read failed", e.getCause()); throw e; } Prevention
- Grant the CDC user SELECT on information_schema before starting the connector.
- Validate JDBC connectivity with a mysql client in CI before deploying.
- Keep JDBC timeouts generous on slow networks.
When it happens
Trigger: SQLException thrown while running the charset/collation discovery query inside readDatabaseCollations during connector startup: connection dropped mid-query, user lacks privileges on information_schema, or the query times out.
Common situations: MySQL user restricted by GRANTs so charset metadata tables are not readable; network/proxy dropping long connections; server restarted during startup; older MySQL variants with different metadata table layout.
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
- Error reading MySQL variables:
- Unexpected error while connecting to MySQL and looking at GT
- Unexpected error while connecting to MySQL and looking at pr
- Unexpected error while connecting to MySQL and looking for b
- Unexpected error while connecting to MySQL and looking at BI
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/61d099ff7461abb5.
Report an issue: GitHub.