apache/beam · info
Wrong JDBC type. Expected '{}' but got '{}'. Overriding with
Error message
Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'. What it means
In ReadFromMySqlSchemaTransformProvider.from, the JDBC type supplied in the configuration does not match the provider's own dialect (mysql). The provider logs a warning and silently overrides the configured jdbcType with its own value instead of failing.
Source
Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromMySqlSchemaTransformProvider.java:60
return getUrn(ExternalTransforms.ManagedTransforms.Urns.MYSQL_READ);
}
@Override
public String description() {
return inheritedDescription("MySQL", "ReadFromMySql", "mysql", 3306);
}
@Override
protected String jdbcType() {
return MYSQL;
}
@Override
public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(
JdbcReadSchemaTransformConfiguration configuration) {
String jdbcType = configuration.getJdbcType();
if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) {
LOG.warn(
"Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.",
jdbcType(),
jdbcType,
jdbcType());
configuration = configuration.toBuilder().setJdbcType(jdbcType()).build();
}
Integer fetchSize = configuration.getFetchSize();
if (fetchSize != null
&& fetchSize > 0
&& configuration.getJdbcUrl() != null
&& !configuration.getJdbcUrl().contains("useCursorFetch=true")) {
throw new IllegalArgumentException(
"It is required to set useCursorFetch=true"
+ " in the JDBC URL when using fetchSize for MySQL");
}
return new MySqlReadSchemaTransform(configuration);
}View on GitHub (pinned to 12126d8942)
Solutions
- Remove the jdbcType field from the configuration and let the provider set its own dialect
- Set jdbcType to 'mysql' when using the MySQL provider (use ReadFromPostgresSchemaTransformProvider for Postgres)
- Route the configuration to the correct provider matching the configured jdbcType
Example fix
// before
configuration = JdbcReadSchemaTransformConfiguration.builder()
.setJdbcType("postgres")
.setUrl(url).build();
// after
configuration = JdbcReadSchemaTransformConfiguration.builder()
.setJdbcType("mysql") // or omit; provider overrides anyway
.setUrl(url).build(); Defensive patterns
Strategy: validation
Validate before calling
// before building the configuration
if (jdbcType != null && !jdbcType.isEmpty() && !"mysql".equals(jdbcType)) {
throw new IllegalArgumentException("ReadFromMySql requires jdbcType=mysql, got: " + jdbcType);
} Prevention
- Match jdbcType to the provider (mysql -> ReadFromMySql, postgresql -> ReadFromPostgres)
- Omit jdbcType and let the provider set its own dialect
- Parameterize pipeline YAML per database rather than sharing a jdbcType field across providers
When it happens
Trigger: Constructing a JdbcReadSchemaTransformConfiguration with a non-empty jdbcType that is not 'mysql' (e.g., 'postgresql') and passing it to the MySQL schema transform provider.
Common situations: Users building pipeline YAML/config that sets jdbcType once and reuses it across database providers, or typo'd jdbcType values; common when switching a pipeline between MySQL and Postgres providers.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- JDBC URL cannot be blank
- If JDBC type is not specified, then Driver Class Name and Dr
- One of JDBC Driver class name or JDBC type must be specified
- JDBC type must be one of ${JDBC_DRIVER_MAP.keySet()} but was
- Write Statement and Table are mutually exclusive configurati
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/b9cd4f9a7c52ea43.
Report an issue: GitHub.