OtterMind/Chat2DB · error · BusinessException
copyInValues.unsupportedDataSource
copyInValues.unsupportedDataSource
Error message
copyInValues.unsupportedDataSource
What it means
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.
Source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbDlTemplateServiceImpl.java:178
public String updateSelectResult(DbSelectResultUpdateRequest param) {
ISqlBuilder sqlBuilder = Chat2DBContext.getSqlBuilder();
QueryResponse queryResult = commandConverter.updateSelectResult2query(param);
return sqlBuilder.dml().buildByQueryResult(queryResult);
}
@Override
public String copySelectResult(DbSelectResultUpdateRequest param) {
ISqlBuilder sqlBuilder = Chat2DBContext.getSqlBuilder();
QueryResponse queryResult = commandConverter.updateSelectResult2query(param);
return sqlBuilder.dml().buildCopyByQueryResult(queryResult);
}
@Override
public String copyInValues(DbCopyInValuesRequest param) {
ISqlBuilder sqlBuilder = Chat2DBContext.getSqlBuilder();
if (!(sqlBuilder instanceof DefaultSqlBuilder)) {
throw new BusinessException("copyInValues.unsupportedDataSource");
}
DefaultSqlBuilder defaultSqlBuilder = (DefaultSqlBuilder) sqlBuilder;
if (StringUtils.equalsIgnoreCase(DbCopyInValuesRequest.SOURCE_TYPE_EXTERNAL_TEXT, param.getSourceType())) {
return defaultSqlBuilder.copyExternalTextInValues(param.getExternalValues());
}
if (!StringUtils.equalsIgnoreCase(DbCopyInValuesRequest.SOURCE_TYPE_RESULT_SET, param.getSourceType())) {
throw new BusinessException("copyInValues.invalidSourceType");
}
QueryResponse queryResult = commandConverter.copyInValues2query(param);
return defaultSqlBuilder.copyInValuesByQuery(queryResult);
}
@Override
public ExecuteResponse validate(DbSqlValidateRequest param) {
String sql = param.getSql();
ICommandExecutor executor = Chat2DBContext.getDbMetaData().getCommandExecutor();
if (StringUtils.isEmpty(sql)) {
return ExecuteResponse.builder().success(true).build();View on GitHub (pinned to 5ee1e990e7)
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.
Defensive patterns
Strategy: type-guard
Type guard
ISqlBuilder builder = Chat2DBContext.getSqlBuilder(); boolean canCopyInValues = builder instanceof DefaultSqlBuilder; // only call copyInValues when canCopyInValues is true
Prevention
- Disable the copy-in-values action for non-JDBC datasources in the UI.
- Check instanceof DefaultSqlBuilder before calling copyInValues.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/02aefe87880b87e2.
Report an issue: GitHub.