{"record":{"id":"02bce2ebf80dab59","repo":"apache/seatunnel","slug":"the-jdbc-url-format-is-incorrect-url","errorCode":null,"errorMessage":"The jdbc url format is incorrect: ${url}","messagePattern":"The jdbc url format is incorrect: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/JdbcUrlUtil.java","lineNumber":49,"sourceCode":"            Pattern.compile(\n                    \"^(?<url>jdbc:.+?//(?<host>.+?):(?<port>\\\\d+?))(/(?<database>.*?))*(?<suffix>\\\\?.*)*$\");\n\n    private JdbcUrlUtil() {}\n\n    public static JdbcUrlUtil.UrlInfo getUrlInfo(String url) {\n        Matcher matcher = URL_PATTERN.matcher(url);\n        if (matcher.find()) {\n            String urlWithoutDatabase = matcher.group(\"url\");\n            String database = matcher.group(\"database\");\n            return new JdbcUrlUtil.UrlInfo(\n                    url,\n                    urlWithoutDatabase,\n                    matcher.group(\"host\"),\n                    Integer.valueOf(matcher.group(\"port\")),\n                    database,\n                    matcher.group(\"suffix\"));\n        }\n        throw new IllegalArgumentException(\"The jdbc url format is incorrect: \" + url);\n    }\n\n    @Data\n    public static class UrlInfo implements Serializable {\n        private static final long serialVersionUID = 1L;\n        private final String origin;\n        private final String urlWithoutDatabase;\n        private final String host;\n        private final Integer port;\n        private final String suffix;\n        private final String defaultDatabase;\n\n        public UrlInfo(\n                String origin,\n                String urlWithoutDatabase,\n                String host,\n                Integer port,\n                String defaultDatabase,","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/JdbcUrlUtil.java#L31-L67","documentation":"JdbcUrlUtil.getUrlInfo parses a JDBC URL into host, port, database and suffix parts. It throws this IllegalArgumentException when the URL does not match the supported JDBC URL regex (scheme://host:port[/database][?suffix]). The library throws it to fail fast on URLs it cannot decompose rather than returning partial data.","triggerScenarios":"Calling JdbcUrlUtil.getUrlInfo(url) with a URL that lacks the expected scheme, omits host or port, contains unexpected characters, or otherwise fails the built-in matcher.","commonSituations":"Typo in the jdbc scheme (e.g. 'jdbc:mysql//host' missing colon), using a connection string style the parser doesn't support (e.g. jdbc:oracle:thin:@host:port:sid SID style), hostnames with underscores, copied URLs with stray spaces or quotes, database name embedded differently per vendor dialect.","solutions":["Print and inspect the exact url string; verify it matches pattern jdbc:<db>://<host>:<port>[/<database>][?<params>]","Fix scheme typos and remove whitespace/quotes from the connection string","For vendor-specific URL styles not supported (SID vs service name, unix sockets), convert to the standard host:port form","If the URL comes from config, validate it with a regex before passing to getUrlInfo"],"exampleFix":"// before\nString url = \"jdbc:mysql//localhost:3306/mydb\"; // missing ':' after mysql\nUrlInfo info = JdbcUrlUtil.getUrlInfo(url);\n// after\nString url = \"jdbc:mysql://localhost:3306/mydb\";\nUrlInfo info = JdbcUrlUtil.getUrlInfo(url);","handlingStrategy":"validation","validationCode":"boolean looksLikeJdbcUrl(String url) {\n    return url != null && url.matches(\"jdbc:[a-zA-Z0-9]+://[^:/\\\\s]+:\\\\d+(/[\\\\w.-]+)?(\\\\?.*)?\");\n}\nif (!looksLikeJdbcUrl(url)) throw new IllegalArgumentException(\"unsupported jdbc url: \" + url);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate jdbc URLs with a regex at config-loading time, before job start","Trim whitespace and strip quotes from connection strings read from files/env","Keep a test that calls getUrlInfo on every URL template used by your connectors"],"tags":["jdbc","url-parsing","illegal-argument"],"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-14T05:17:10.506Z"}