{"record":{"id":"71d83f73b0201096","repo":"apache/dolphinscheduler","slug":"database-name-illegal","errorCode":null,"errorMessage":"database name illegal","messagePattern":"database name illegal","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java","lineNumber":85,"sourceCode":"     * Check the host is valid\n     *\n     * @param host datasource host\n     */\n    protected void checkHost(String host) {\n        if (com.google.common.net.InetAddresses.isInetAddress(host)) {\n        } else if (!IPV4_PATTERN.matcher(host).matches() || !IPV6_PATTERN.matcher(host).matches()) {\n            throw new IllegalArgumentException(\"datasource host illegal\");\n        }\n    }\n\n    /**\n     * check database name is valid\n     *\n     * @param database database name\n     */\n    protected void checkDatabasePatter(String database) {\n        if (!DATABASE_PATTER.matcher(database).matches()) {\n            throw new IllegalArgumentException(\"database name illegal\");\n        }\n    }\n\n    /**\n     * check other is valid\n     *\n     * @param other other\n     */\n    protected void checkOther(Map<String, String> other) {\n        if (MapUtils.isEmpty(other)) {\n            return;\n        }\n\n        if (!Sets.intersection(other.keySet(), POSSIBLE_MALICIOUS_KEYS).isEmpty()) {\n            throw new IllegalArgumentException(\"Other params include possible malicious keys.\");\n        }\n\n        for (Map.Entry<String, String> entry : other.entrySet()) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java#L67-L103","documentation":"Generic validation guard in AbstractDataSourceProcessor.checkDatabasePatter: fires when the database name does not match DATABASE_PATTER (identifier charset pattern), meaning the supplied database name contains illegal characters or is empty.","triggerScenarios":"Creating/updating a datasource whose database field contains illegal characters (dashes, dots, spaces, special chars) or is empty.","commonSituations":"Database names with hyphens (common in cloud providers), names copied with trailing spaces, schema-qualified names like 'db.schema'.","solutions":["Use only [a-zA-Z0-9_-] style characters allowed by DATABASE_PATTER","Rename or quote the database at the DB level and reference the compliant name","Check for accidental whitespace when pasting the database name"],"exampleFix":"// before\nparam.setDatabase(\"my-db.v2\");\n// after\nparam.setDatabase(\"my_db_v2\");","handlingStrategy":"validation","validationCode":"boolean dbOk = database != null && database.matches(\"^[a-zA-Z0-9_]+$\");","typeGuard":null,"tryCatchPattern":"try { dto.setDatabase(name); processor.checkDatasourceParam(dto); } catch (IllegalArgumentException e) { /* surface 'database name illegal' to user */ }","preventionTips":["Use identifiers matching ^[a-zA-Z0-9_]+$","Avoid hyphens/dots in database names","Trim pasted values"],"tags":["validation","datasource","identifier"],"backgroundTag":"invalid-identifier-format","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}