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 write SchemaTransform provider when the configuration's jdbcType differs from the provider's jdbcType(). The value is overridden with the provider's own type and the write proceeds against SQL Server. It indicates a misconfigured database type in the write path.
Source
Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/WriteToSqlServerSchemaTransformProvider.java:62
return getUrn(ExternalTransforms.ManagedTransforms.Urns.SQL_SERVER_WRITE);
}
@Override
public String description() {
return inheritedDescription("SQL Server", "WriteToSqlServer", "sqlserver", 1433);
}
@Override
protected String jdbcType() {
return MSSQL;
}
@Override
public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(
JdbcWriteSchemaTransformConfiguration 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 SqlServerWriteSchemaTransform(configuration);
}
View on GitHub (pinned to 12126d8942)
Solutions
- Remove jdbcType from the write configuration so the SQL Server default is used.
- Set jdbcType to the SQL Server provider's jdbcType() value.
- Use the matching provider class for the actual target database.
- Confirm the JDBC URL (jdbc:sqlserver://...) matches SQL Server.
Example fix
// before
JdbcWriteSchemaTransformConfiguration cfg = JdbcWriteSchemaTransformConfiguration.builder()
.setJdbcType("oracle")
.setUrl("jdbc:sqlserver://host;databaseName=db")
.build();
// after
JdbcWriteSchemaTransformConfiguration cfg = JdbcWriteSchemaTransformConfiguration.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 write provider.
- Match provider class and JDBC URL to the same database.
- Add a config smoke test that builds the transform and inspects the resolved configuration.
When it happens
Trigger: Calling from() on WriteToSqlServerSchemaTransformProvider with a JdbcWriteSchemaTransformConfiguration whose jdbcType is non-null, non-empty, and unequal to jdbcType().
Common situations: Reusing a Postgres/MySQL write configuration for a SQL Server sink, or an expansion-service config carrying a stale jdbcType after switching databases.
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/cbe2a9fc79c06aae.
Report an issue: GitHub.