apache/beam · error · IllegalArgumentException
SQL Server does not support connectionInitSql.
Error message
SQL Server does not support connectionInitSql.
What it means
Thrown by WriteToSqlServerSchemaTransformProvider.from() when connectionInitSql is supplied. The SQL Server write path does not support connection initialization SQL; the provider fails fast and then explicitly resets the list to empty before building a SqlServerWriteSchemaTransform.
Source
Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/WriteToSqlServerSchemaTransformProvider.java:73
}
@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);
}
public static class SqlServerWriteSchemaTransform extends JdbcWriteSchemaTransform {
public SqlServerWriteSchemaTransform(JdbcWriteSchemaTransformConfiguration config) {
super(config, MSSQL);
config.validate(MSSQL);
}
}
}
View on GitHub (pinned to 12126d8942)
Solutions
- Remove connectionInitSql entries from the SQL Server write configuration
- Apply required session settings via SQL Server database/user defaults or within the write statements
- Gate connectionInitSql to dialects that support it in your config templating
Example fix
// before
builder().setConnectionInitSql(ImmutableList.of("SET NOCOUNT ON"))
// after
builder() // use server/database defaults instead Defensive patterns
Strategy: validation
Validate before calling
if (connectionInitSql != null && !connectionInitSql.isEmpty()) {
throw new IllegalArgumentException("SQL Server write does not support connectionInitSql; remove it from the config");
} Prevention
- Prune unsupported options when migrating pipelines between database backends
- Use SQL Server login/user defaults for session settings
- Document which JdbcSchemaTransform options are dialect-specific
When it happens
Trigger: Calling WriteToSqlServerSchemaTransformProvider.from()/builder with a non-empty connectionInitSql list.
Common situations: Shared JDBC configuration reused across MySQL and SQL Server writes; templated configs always emitting connectionInitSql; migrations from MySQL to SQL Server without option cleanup.
Related errors
- SQL Server does not support connectionInitSql.
- It is required to set useCursorFetch=true in the JDBC URL wh
- Postgres does not support connectionInitSql.
- Postgres does not support connectionInitSql.
- Wrong JDBC type. Expected '{}' but got '{}'. Overriding with
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/8a2fdf8bfebb30fe.
Report an issue: GitHub.