I am trying to use SchemaCrawler to extract schema information on db2 test database.
When running the schema
command with text or html format, things work as expected:
./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 ...)
Now I want to output it in JSON format for data integration purpose. So I tried running the schema
command with output in json format, and it failed (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
I have also tried it with 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
As an aside, I am also facing similar issue when running against Oracle server.
So, two questions:
Thank you.
Sutandiono,
You can absolutely extract the schema metadata in JSON format for IBM DB2 and Oracle databases. Your log is not complete, so I cannot see the stacktrace right at the the end. What I can see, though, is that you have Jackson jar files on your classpath, which is good. Other than that, you can try with an additional command-line argument of --output-format json
. (Please let me know if this works.) In the next SchemaCrawler version, you will get a better error message, like this "Error: Output format not supported for command ", which will help you.
Sualeh Fatehi, SchemaCrawler