{"record":{"id":"534103a9a417b9ad","repo":"apache/seatunnel","slug":"invalid-sqlserver-jdbc-url-format-s-expected","errorCode":null,"errorMessage":"Invalid SqlServer JDBC URL format: [%s], expected pattern: jdbc:sqlserver://host:port[;databaseName=db]","messagePattern":"Invalid SqlServer JDBC URL format: \\[(.+?)\\], expected pattern: jdbc:sqlserver://host:port\\[;databaseName=db\\]","errorType":"validation","errorClass":"OptionValidationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/sqlserver/SqlServerCatalogFactory.java","lineNumber":77,"sourceCode":"    }\n\n    /** Validates URL format only; database may be provided via separate config option. */\n    static class SqlServerUrlValidator implements ConditionExtension<String> {\n        @Override\n        public String description() {\n            return \"SqlServer JDBC URL must be a valid format (e.g. jdbc:sqlserver://host:port;databaseName=db)\";\n        }\n\n        @Override\n        public boolean evaluate(ReadonlyConfig config, String url) {\n            if (url == null || url.trim().isEmpty()) {\n                return false;\n            }\n            try {\n                JdbcUrlUtil.UrlInfo info = SqlServerURLParser.parse(url);\n                return info != null && StringUtils.isNotBlank(info.getHost());\n            } catch (IllegalArgumentException e) {\n                throw new OptionValidationException(\n                        String.format(\n                                \"Invalid SqlServer JDBC URL format: [%s], \"\n                                        + \"expected pattern: jdbc:sqlserver://host:port[;databaseName=db]\",\n                                url));\n            }\n        }\n    }\n}\n","sourceCodeStart":59,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/sqlserver/SqlServerCatalogFactory.java#L59-L86","documentation":"The SQL Server JDBC URL validator in SqlServerCatalogFactory.evaluate() parses the URL with SqlServerURLParser; if parsing throws IllegalArgumentException (URL does not match jdbc:sqlserver://host:port[;databaseName=db]), it throws OptionValidationException with the expected pattern. This is a config-time guard so malformed SQL Server URLs fail fast instead of at connection time.","triggerScenarios":"Configuring a SQL Server catalog/connection with a url that does not start with jdbc:sqlserver:// or lacks a valid host:port — e.g. jdbc:sqlserver:host (missing //), jdbc:sqlserver://host (no port where the parser requires one), or a scheme for a different database.","commonSituations":"Mixing up SQL Server URL styles (named-instance URLs like jdbc:sqlserver://host\\instance may not match the strict pattern); missing port; copying a SQL Authentication string with the database parameter malformed (;databaseName= without value).","solutions":["Rewrite the URL as jdbc:sqlserver://host:port (optionally ;databaseName=mydb), e.g. jdbc:sqlserver://mssql-host:1433;databaseName=master.","Verify the scheme is exactly jdbc:sqlserver:// with host and numeric port present.","If using a named instance, convert it to the resolved port form (e.g. 1433) so the URL matches the expected pattern.","Trim whitespace/quotes from the config value and re-validate."],"exampleFix":"// before\nurl = \"jdbc:sqlserver://mssql-host\\\\SQLEXPRESS\"\n// after\nurl = \"jdbc:sqlserver://mssql-host:1433;databaseName=mydb\"","handlingStrategy":"validation","validationCode":"// java\nString url = config.get(\"url\");\nif (url == null || !url.matches(\"jdbc:sqlserver://[^:/\\\\s]+:\\\\d+([;\\\\S]*)?\")) {\n    throw new IllegalArgumentException(\"SqlServer url must match jdbc:sqlserver://host:port[;databaseName=db]\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use explicit port (1433 by default) instead of named instances.","Keep the ;databaseName= parameter well-formed.","Strip whitespace before validating."],"tags":["sqlserver","jdbc-url","config-validation"],"backgroundTag":"invalid-url-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}