报错信息:


Error encountered when performing Introspect the Portion of 1 schema (full) on level 1: Unsupported SQL operation: unsupported CommonExpressionSegment.
Unsupported SQL operation: unsupported CommonExpressionSegment.
Unknown exception: At line 0, column 0: Object 'collations' not found within 'information_schema'.
Unknown exception: At line 0, column 0: Object 'user' not found within 'mysql'.
Unknown exception: At line 0, column 0: Object 'user_privileges' not found within 'information_schema'.
Unknown exception: At line 0, column 0: Object 'schema_privileges' not found within 'information_schema'.
Unknown exception: null.
Unknown exception: Unsupported SQL operator: `IS`.
Cannot open cursor: the statement was not executed or it has not returned cursor.
和 1 个重复报告

报错原因:sharding代理库,有些原生语法不支持。

解决方式:使用JDBC元数据内省方式,设置方式如下图:

豆包给出的解释:

DataGrip 中的 "使用 JDBC 元数据内容" 选项

1. 选项作用

  • 当启用此选项时,DataGrip 会直接使用 JDBC 标准接口获取元数据,而不是依赖特定数据库的原生命令或驱动扩展。

  • 例如:

    • 获取表结构时,不使用 SHOW CREATE TABLE(MySQL)或 DESCRIBE(Oracle)等原生命令,而是通过 DatabaseMetaData.getColumns()

    • 获取索引时,不使用 SHOW INDEX(MySQL),而是通过 DatabaseMetaData.getIndexInfo()

2. 典型场景

  • 跨数据库兼容性:当需要在不同数据库系统(如 MySQL、PostgreSQL、Oracle)间切换时,统一使用 JDBC 接口获取元数据,避免依赖特定数据库的语法。

  • 特殊权限环境:在某些受限制的数据库环境中,用户可能没有执行原生命令的权限,但有 JDBC 元数据查询权限。

  • 代理或中间件环境:当数据库前有代理或中间件时,原生命令可能被过滤或修改,而 JDBC 元数据接口更稳定。