{"record":{"id":"02aefe87880b87e2","repo":"OtterMind/Chat2DB","slug":"copyinvalues-unsupporteddatasource","errorCode":"copyInValues.unsupportedDataSource","errorMessage":"copyInValues.unsupportedDataSource","messagePattern":"copyInValues\\.unsupportedDataSource","errorType":"validation","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbDlTemplateServiceImpl.java","lineNumber":178,"sourceCode":"    public String updateSelectResult(DbSelectResultUpdateRequest param) {\n        ISqlBuilder sqlBuilder = Chat2DBContext.getSqlBuilder();\n        QueryResponse queryResult = commandConverter.updateSelectResult2query(param);\n        return sqlBuilder.dml().buildByQueryResult(queryResult);\n    }\n\n    @Override\n    public String copySelectResult(DbSelectResultUpdateRequest param) {\n\n        ISqlBuilder sqlBuilder = Chat2DBContext.getSqlBuilder();\n        QueryResponse queryResult = commandConverter.updateSelectResult2query(param);\n        return sqlBuilder.dml().buildCopyByQueryResult(queryResult);\n    }\n\n    @Override\n    public String copyInValues(DbCopyInValuesRequest param) {\n        ISqlBuilder sqlBuilder = Chat2DBContext.getSqlBuilder();\n        if (!(sqlBuilder instanceof DefaultSqlBuilder)) {\n            throw new BusinessException(\"copyInValues.unsupportedDataSource\");\n        }\n        DefaultSqlBuilder defaultSqlBuilder = (DefaultSqlBuilder) sqlBuilder;\n        if (StringUtils.equalsIgnoreCase(DbCopyInValuesRequest.SOURCE_TYPE_EXTERNAL_TEXT, param.getSourceType())) {\n            return defaultSqlBuilder.copyExternalTextInValues(param.getExternalValues());\n        }\n        if (!StringUtils.equalsIgnoreCase(DbCopyInValuesRequest.SOURCE_TYPE_RESULT_SET, param.getSourceType())) {\n            throw new BusinessException(\"copyInValues.invalidSourceType\");\n        }\n        QueryResponse queryResult = commandConverter.copyInValues2query(param);\n        return defaultSqlBuilder.copyInValuesByQuery(queryResult);\n    }\n\n    @Override\n    public ExecuteResponse validate(DbSqlValidateRequest param) {\n        String sql = param.getSql();\n        ICommandExecutor executor = Chat2DBContext.getDbMetaData().getCommandExecutor();\n        if (StringUtils.isEmpty(sql)) {\n            return ExecuteResponse.builder().success(true).build();","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbDlTemplateServiceImpl.java#L160-L196","documentation":"Thrown by copyInValues when the SqlBuilder resolved from Chat2DBContext.getSqlBuilder() is not an instance of DefaultSqlBuilder. Only the default JDBC SqlBuilder implementation provides the copyInValues/copyExternalTextInValues methods; dialect-specific or NoSQL builders do not support bulk value insertion.","triggerScenarios":"Calling copyInValues(param) on a connection whose dbType resolves to a non-DefaultSqlBuilder (e.g., MongoDB, Redis, or a dialect-specific builder). The instanceof check at line 177 fails.","commonSituations":"User has a MongoDB/Redis connection active and triggers the paste-values/copy-in feature; a dialect plugin registers a custom ISqlBuilder that is not a DefaultSqlBuilder subclass.","solutions":["Switch to a JDBC-based datasource (MySQL, PostgreSQL, etc.) that uses DefaultSqlBuilder.","If the dialect should support copy-in-values, ensure its SqlBuilder extends DefaultSqlBuilder.","Disable the copy-in-values UI action for unsupported datasource types."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"ISqlBuilder builder = Chat2DBContext.getSqlBuilder();\nboolean canCopyInValues = builder instanceof DefaultSqlBuilder;\n// only call copyInValues when canCopyInValues is true","tryCatchPattern":null,"preventionTips":["Disable the copy-in-values action for non-JDBC datasources in the UI.","Check instanceof DefaultSqlBuilder before calling copyInValues."],"tags":["copy-in-values","dbtype-capability","sql-builder"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}