Schemacrawler 无法以 JSON 格式从 DB2(和 Oracle)服务器输出架构

Schemacrawler cannot output the schema from DB2 (and Oracle) server in JSON format

我正在尝试使用 SchemaCrawler 提取 db2 测试数据库中的架构信息。

当 运行 带有文本或 html 格式的 schema 命令时,一切正常:

./schemacrawler.sh --server=db2 --host=127.0.0.1 --port=50000 --database=sample --schemas=DB2INST1 --user="db2inst1" --password=password --info-level=standard --command=schema --tables='.*\.P.*' 


System Information
========================================================================

generated by                              SchemaCrawler 16.9.2          
generated on                              2020-07-17 01:50:58.987909    



Tables
========================================================================



DB2INST1.PRODUCT                                                 [table]
------------------------------------------------------------------------
  PID                               VARCHAR(10) NOT NULL        
  NAME                              VARCHAR(128)                
  PRICE                             DECIMAL(30, 2)              
  PROMOPRICE                        DECIMAL(30, 2)              
  PROMOSTART                        DATE                        
  PROMOEND                          DATE                        
  DESCRIPTION                       XML                         

Primary Key

PK_PRODUCT                                                 [primary key]
  PID                                                           

Indexes

PK_PRODUCT                                                [unique index]
  PID                               ascending                   

(... and so on ...)

现在我想把它输出成JSON格式,以便数据整合。所以我尝试了 运行 schema 命令,输出为 json 格式,但失败了 (full log here):

SchemaCrawler 16.9.2

Error: Unknown command <schema>

Re-run SchemaCrawler with just the
-h
option for help

Or, re-run SchemaCrawler with an additional
--log-level=CONFIG
option for details on the error

我也试过 the command serialize, and it failed as well (full log here):

SchemaCrawler 16.9.2

Error: Unknown command <serialize>

Re-run SchemaCrawler with just the
-h
option for help

Or, re-run SchemaCrawler with an additional
--log-level=CONFIG
option for details on the error

顺便说一句,当 运行 针对 Oracle 服务器时,我也面临类似的问题。

那么,两个问题:

  1. 如何从 db2 服务器中提取 JSON 格式的架构信息?
  2. 如何对 Oracle 服务器执行相同的操作?

谢谢。

苏坦迪奥诺,

您完全可以提取 IBM DB2 和 Oracle 数据库的 JSON 格式的模式元数据。您的日志不完整,所以我最后看不到堆栈跟踪。不过,我可以看到,您的类路径中有 Jackson jar 文件,这很好。除此之外,您可以尝试使用额外的命令行参数 --output-format json。 (如果可行,请告诉我。)在下一个 SchemaCrawler 版本中,您将收到更好的错误消息,例如“错误:命令不支持输出格式”,这将对您有所帮助。

Sualeh Fatehi,SchemaCrawler