{"record":{"id":"8a2fdf8bfebb30fe","repo":"apache/beam","slug":"sql-server-does-not-support-connectioninitsql-8a2fdf","errorCode":null,"errorMessage":"SQL Server does not support connectionInitSql.","messagePattern":"SQL Server does not support connectionInitSql\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/WriteToSqlServerSchemaTransformProvider.java","lineNumber":73,"sourceCode":"  }\n\n  @Override\n  public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(\n      JdbcWriteSchemaTransformConfiguration configuration) {\n    String jdbcType = configuration.getJdbcType();\n    if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) {\n      LOG.warn(\n          \"Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.\",\n          jdbcType(),\n          jdbcType,\n          jdbcType());\n      configuration = configuration.toBuilder().setJdbcType(jdbcType()).build();\n    }\n\n    List<@org.checkerframework.checker.nullness.qual.Nullable String> connectionInitSql =\n        configuration.getConnectionInitSql();\n    if (connectionInitSql != null && !connectionInitSql.isEmpty()) {\n      throw new IllegalArgumentException(\"SQL Server does not support connectionInitSql.\");\n    }\n\n    // Override \"connectionInitSql\" for sqlserver\n    configuration = configuration.toBuilder().setConnectionInitSql(Collections.emptyList()).build();\n    return new SqlServerWriteSchemaTransform(configuration);\n  }\n\n  public static class SqlServerWriteSchemaTransform extends JdbcWriteSchemaTransform {\n    public SqlServerWriteSchemaTransform(JdbcWriteSchemaTransformConfiguration config) {\n      super(config, MSSQL);\n      config.validate(MSSQL);\n    }\n  }\n}\n","sourceCodeStart":55,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/WriteToSqlServerSchemaTransformProvider.java#L55-L88","documentation":"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.","triggerScenarios":"Calling WriteToSqlServerSchemaTransformProvider.from()/builder with a non-empty connectionInitSql list.","commonSituations":"Shared JDBC configuration reused across MySQL and SQL Server writes; templated configs always emitting connectionInitSql; migrations from MySQL to SQL Server without option cleanup.","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"],"exampleFix":"// before\nbuilder().setConnectionInitSql(ImmutableList.of(\"SET NOCOUNT ON\"))\n// after\nbuilder() // use server/database defaults instead","handlingStrategy":"validation","validationCode":"if (connectionInitSql != null && !connectionInitSql.isEmpty()) {\n  throw new IllegalArgumentException(\"SQL Server write does not support connectionInitSql; remove it from the config\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["jdbc","sqlserver","beam","configuration"],"backgroundTag":"unsupported-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}