apache/beam · warning
Wrong JDBC type. Expected '{}' but got '{}'. Overriding with
Error message
Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'. What it means
Warning logged by the SQL Server read SchemaTransform provider when the configuration's jdbcType does not match the provider's jdbcType(). The value is overridden with the provider's own type and execution continues against SQL Server. It signals a mismatched database configuration.
Source
Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromSqlServerSchemaTransformProvider.java:62
return getUrn(ExternalTransforms.ManagedTransforms.Urns.SQL_SERVER_READ);
}
@Override
public String description() {
return inheritedDescription("SQL Server", "ReadFromSqlServer", "sqlserver", 1433);
}
@Override
protected String jdbcType() {
return MSSQL;
}
@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();
}
List<@org.checkerframework.checker.nullness.qual.Nullable String> connectionInitSql =
configuration.getConnectionInitSql();
if (connectionInitSql != null && !connectionInitSql.isEmpty()) {
throw new IllegalArgumentException("SQL Server does not support connectionInitSql.");
}
// Override "connectionInitSql" for sqlserver
configuration = configuration.toBuilder().setConnectionInitSql(Collections.emptyList()).build();
return new SqlServerReadSchemaTransform(configuration);
}
View on GitHub (pinned to 12126d8942)
Solutions
- Clear the jdbcType field from the configuration so the provider default applies.
- Set jdbcType to the SQL Server provider's jdbcType() value.
- Use the correct provider (e.g. ReadFromPostgresSchemaTransformProvider) if SQL Server is not the real target.
- Confirm the URL and driver in the configuration also match SQL Server.
Example fix
// before
JdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()
.setJdbcType("postgres")
.setUrl("jdbc:sqlserver://host;databaseName=db")
.build();
// after
JdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()
.setUrl("jdbc:sqlserver://host;databaseName=db")
.build(); Defensive patterns
Strategy: validation
Validate before calling
if (config.getJdbcType() != null && !config.getJdbcType().isEmpty()
&& !"sqlserver".equalsIgnoreCase(config.getJdbcType())) {
throw new IllegalArgumentException("jdbcType must match the SQL Server provider");
} Prevention
- Omit jdbcType when using the SQL Server provider.
- Keep one config builder per database.
- Assert jdbcType consistency in pipeline unit tests.
When it happens
Trigger: Passing a JdbcReadSchemaTransformConfiguration with a non-empty jdbcType differing from the SQL Server provider's jdbcType() into ReadFromSqlServerSchemaTransformProvider.from().
Common situations: Reusing a config object created for Postgres or MySQL for a SQL Server read, or templating pipelines where jdbcType is set from a generic variable.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Wrong JDBC type. Expected '{}' but got '{}'. Overriding with
- SQL Server does not support connectionInitSql.
- SQL Server does not support connectionInitSql.
- Wrong JDBC type. Expected '{}' but got '{}'. Overriding with
- Postgres reads require disableAutoCommit to be true, overrid
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/337ba89163e9859b.
Report an issue: GitHub.